2 /* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse llvmAsmparse
8 #define yylex llvmAsmlex
9 #define yyerror llvmAsmerror
10 #define yylval llvmAsmlval
11 #define yychar llvmAsmchar
12 #define yydebug llvmAsmdebug
13 #define yynerrs llvmAsmnerrs
14 #define ESINT64VAL 257
15 #define EUINT64VAL 258
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/ProjectsDisk/cvs/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/AutoUpgrade.h"
167 #include "llvm/Support/GetElementPtrTypeIterator.h"
168 #include "llvm/Support/CommandLine.h"
169 #include "llvm/ADT/SmallVector.h"
170 #include "llvm/ADT/STLExtras.h"
171 #include "llvm/Support/MathExtras.h"
172 #include "llvm/Support/Streams.h"
181 // The following is a gross hack. In order to rid the libAsmParser library of
182 // exceptions, we have to have a way of getting the yyparse function to go into
183 // an error situation. So, whenever we want an error to occur, the GenerateError
184 // function (see bottom of file) sets TriggerError. Then, at the end of each
185 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
186 // (a goto) to put YACC in error state. Furthermore, several calls to
187 // GenerateError are made from inside productions and they must simulate the
188 // previous exception behavior by exiting the production immediately. We have
189 // replaced these with the GEN_ERROR macro which calls GeneratError and then
190 // immediately invokes YYERROR. This would be so much cleaner if it was a
191 // recursive descent parser.
192 static bool TriggerError = false;
193 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
194 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
196 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
197 int yylex(); // declaration" of xxx warnings.
201 std::string CurFilename;
204 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
205 cl::Hidden, cl::init(false));
208 using namespace llvm;
210 static Module *ParserResult;
212 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
213 // relating to upreferences in the input stream.
215 //#define DEBUG_UPREFS 1
217 #define UR_OUT(X) cerr << X
222 #define YYERROR_VERBOSE 1
224 static GlobalVariable *CurGV;
227 // This contains info used when building the body of a function. It is
228 // destroyed when the function is completed.
230 typedef std::vector<Value *> ValueList; // Numbered defs
233 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
235 static struct PerModuleInfo {
236 Module *CurrentModule;
237 ValueList Values; // Module level numbered definitions
238 ValueList LateResolveValues;
239 std::vector<PATypeHolder> Types;
240 std::map<ValID, PATypeHolder> LateResolveTypes;
242 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
243 /// how they were referenced and on which line of the input they came from so
244 /// that we can resolve them later and print error messages as appropriate.
245 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
247 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
248 // references to global values. Global values may be referenced before they
249 // are defined, and if so, the temporary object that they represent is held
250 // here. This is used for forward references of GlobalValues.
252 typedef std::map<std::pair<const PointerType *,
253 ValID>, GlobalValue*> GlobalRefsType;
254 GlobalRefsType GlobalRefs;
257 // If we could not resolve some functions at function compilation time
258 // (calls to functions before they are defined), resolve them now... Types
259 // are resolved when the constant pool has been completely parsed.
261 ResolveDefinitions(LateResolveValues);
265 // Check to make sure that all global value forward references have been
268 if (!GlobalRefs.empty()) {
269 std::string UndefinedReferences = "Unresolved global references exist:\n";
271 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
273 UndefinedReferences += " " + I->first.first->getDescription() + " " +
274 I->first.second.getName() + "\n";
276 GenerateError(UndefinedReferences);
280 // Look for intrinsic functions and CallInst that need to be upgraded
281 for (Module::iterator FI = CurrentModule->begin(),
282 FE = CurrentModule->end(); FI != FE; )
283 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
285 Values.clear(); // Clear out function local definitions
290 // GetForwardRefForGlobal - Check to see if there is a forward reference
291 // for this global. If so, remove it from the GlobalRefs map and return it.
292 // If not, just return null.
293 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
294 // Check to see if there is a forward reference to this global variable...
295 // if there is, eliminate it and patch the reference to use the new def'n.
296 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
297 GlobalValue *Ret = 0;
298 if (I != GlobalRefs.end()) {
305 bool TypeIsUnresolved(PATypeHolder* PATy) {
306 // If it isn't abstract, its resolved
307 const Type* Ty = PATy->get();
308 if (!Ty->isAbstract())
310 // Traverse the type looking for abstract types. If it isn't abstract then
311 // we don't need to traverse that leg of the type.
312 std::vector<const Type*> WorkList, SeenList;
313 WorkList.push_back(Ty);
314 while (!WorkList.empty()) {
315 const Type* Ty = WorkList.back();
316 SeenList.push_back(Ty);
318 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
319 // Check to see if this is an unresolved type
320 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
321 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
322 for ( ; I != E; ++I) {
323 if (I->second.get() == OpTy)
326 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
327 const Type* TheTy = SeqTy->getElementType();
328 if (TheTy->isAbstract() && TheTy != Ty) {
329 std::vector<const Type*>::iterator I = SeenList.begin(),
335 WorkList.push_back(TheTy);
337 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
338 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
339 const Type* TheTy = StrTy->getElementType(i);
340 if (TheTy->isAbstract() && TheTy != Ty) {
341 std::vector<const Type*>::iterator I = SeenList.begin(),
347 WorkList.push_back(TheTy);
356 static struct PerFunctionInfo {
357 Function *CurrentFunction; // Pointer to current function being created
359 ValueList Values; // Keep track of #'d definitions
361 ValueList LateResolveValues;
362 bool isDeclare; // Is this function a forward declararation?
363 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
364 GlobalValue::VisibilityTypes Visibility;
366 /// BBForwardRefs - When we see forward references to basic blocks, keep
367 /// track of them here.
368 std::map<ValID, BasicBlock*> BBForwardRefs;
370 inline PerFunctionInfo() {
373 Linkage = GlobalValue::ExternalLinkage;
374 Visibility = GlobalValue::DefaultVisibility;
377 inline void FunctionStart(Function *M) {
382 void FunctionDone() {
383 // Any forward referenced blocks left?
384 if (!BBForwardRefs.empty()) {
385 GenerateError("Undefined reference to label " +
386 BBForwardRefs.begin()->second->getName());
390 // Resolve all forward references now.
391 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
393 Values.clear(); // Clear out function local definitions
394 BBForwardRefs.clear();
397 Linkage = GlobalValue::ExternalLinkage;
398 Visibility = GlobalValue::DefaultVisibility;
400 } CurFun; // Info for the current function...
402 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
405 //===----------------------------------------------------------------------===//
406 // Code to handle definitions of all the types
407 //===----------------------------------------------------------------------===//
409 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
410 // Things that have names or are void typed don't get slot numbers
411 if (V->hasName() || (V->getType() == Type::VoidTy))
414 // In the case of function values, we have to allow for the forward reference
415 // of basic blocks, which are included in the numbering. Consequently, we keep
416 // track of the next insertion location with NextValNum. When a BB gets
417 // inserted, it could change the size of the CurFun.Values vector.
418 if (&ValueTab == &CurFun.Values) {
419 if (ValueTab.size() <= CurFun.NextValNum)
420 ValueTab.resize(CurFun.NextValNum+1);
421 ValueTab[CurFun.NextValNum++] = V;
424 // For all other lists, its okay to just tack it on the back of the vector.
425 ValueTab.push_back(V);
428 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
430 case ValID::LocalID: // Is it a numbered definition?
431 // Module constants occupy the lowest numbered slots...
432 if (D.Num < CurModule.Types.size())
433 return CurModule.Types[D.Num];
435 case ValID::LocalName: // Is it a named definition?
436 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
437 D.destroy(); // Free old strdup'd memory...
442 GenerateError("Internal parser error: Invalid symbol type reference");
446 // If we reached here, we referenced either a symbol that we don't know about
447 // or an id number that hasn't been read yet. We may be referencing something
448 // forward, so just create an entry to be resolved later and get to it...
450 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
453 if (inFunctionScope()) {
454 if (D.Type == ValID::LocalName) {
455 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
458 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
463 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
464 if (I != CurModule.LateResolveTypes.end())
467 Type *Typ = OpaqueType::get();
468 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
472 // getExistingVal - Look up the value specified by the provided type and
473 // the provided ValID. If the value exists and has already been defined, return
474 // it. Otherwise return null.
476 static Value *getExistingVal(const Type *Ty, const ValID &D) {
477 if (isa<FunctionType>(Ty)) {
478 GenerateError("Functions are not values and "
479 "must be referenced as pointers");
484 case ValID::LocalID: { // Is it a numbered definition?
485 // Check that the number is within bounds.
486 if (D.Num >= CurFun.Values.size())
488 Value *Result = CurFun.Values[D.Num];
489 if (Ty != Result->getType()) {
490 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
491 Result->getType()->getDescription() + "' does not match "
492 "expected type, '" + Ty->getDescription() + "'");
497 case ValID::GlobalID: { // Is it a numbered definition?
498 if (D.Num >= CurModule.Values.size())
500 Value *Result = CurModule.Values[D.Num];
501 if (Ty != Result->getType()) {
502 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
503 Result->getType()->getDescription() + "' does not match "
504 "expected type, '" + Ty->getDescription() + "'");
510 case ValID::LocalName: { // Is it a named definition?
511 if (!inFunctionScope())
513 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
514 Value *N = SymTab.lookup(D.getName());
517 if (N->getType() != Ty)
520 D.destroy(); // Free old strdup'd memory...
523 case ValID::GlobalName: { // Is it a named definition?
524 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
525 Value *N = SymTab.lookup(D.getName());
528 if (N->getType() != Ty)
531 D.destroy(); // Free old strdup'd memory...
535 // Check to make sure that "Ty" is an integral type, and that our
536 // value will fit into the specified type...
537 case ValID::ConstSIntVal: // Is it a constant pool reference??
538 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
539 GenerateError("Signed integral constant '" +
540 itostr(D.ConstPool64) + "' is invalid for type '" +
541 Ty->getDescription() + "'");
544 return ConstantInt::get(Ty, D.ConstPool64, true);
546 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
547 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
548 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
549 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
550 "' is invalid or out of range");
552 } else { // This is really a signed reference. Transmogrify.
553 return ConstantInt::get(Ty, D.ConstPool64, true);
556 return ConstantInt::get(Ty, D.UConstPool64);
559 case ValID::ConstFPVal: // Is it a floating point const pool reference?
560 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
561 GenerateError("FP constant invalid for type");
564 return ConstantFP::get(Ty, D.ConstPoolFP);
566 case ValID::ConstNullVal: // Is it a null value?
567 if (!isa<PointerType>(Ty)) {
568 GenerateError("Cannot create a a non pointer null");
571 return ConstantPointerNull::get(cast<PointerType>(Ty));
573 case ValID::ConstUndefVal: // Is it an undef value?
574 return UndefValue::get(Ty);
576 case ValID::ConstZeroVal: // Is it a zero value?
577 return Constant::getNullValue(Ty);
579 case ValID::ConstantVal: // Fully resolved constant?
580 if (D.ConstantValue->getType() != Ty) {
581 GenerateError("Constant expression type different from required type");
584 return D.ConstantValue;
586 case ValID::InlineAsmVal: { // Inline asm expression
587 const PointerType *PTy = dyn_cast<PointerType>(Ty);
588 const FunctionType *FTy =
589 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
590 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
591 GenerateError("Invalid type for asm constraint string");
594 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
595 D.IAD->HasSideEffects);
596 D.destroy(); // Free InlineAsmDescriptor.
600 assert(0 && "Unhandled case!");
604 assert(0 && "Unhandled case!");
608 // getVal - This function is identical to getExistingVal, except that if a
609 // value is not already defined, it "improvises" by creating a placeholder var
610 // that looks and acts just like the requested variable. When the value is
611 // defined later, all uses of the placeholder variable are replaced with the
614 static Value *getVal(const Type *Ty, const ValID &ID) {
615 if (Ty == Type::LabelTy) {
616 GenerateError("Cannot use a basic block here");
620 // See if the value has already been defined.
621 Value *V = getExistingVal(Ty, ID);
623 if (TriggerError) return 0;
625 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
626 GenerateError("Invalid use of a composite type");
630 // If we reached here, we referenced either a symbol that we don't know about
631 // or an id number that hasn't been read yet. We may be referencing something
632 // forward, so just create an entry to be resolved later and get to it...
635 case ValID::GlobalName:
636 case ValID::GlobalID: {
637 const PointerType *PTy = dyn_cast<PointerType>(Ty);
639 GenerateError("Invalid type for reference to global" );
642 const Type* ElTy = PTy->getElementType();
643 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
644 V = new Function(FTy, GlobalValue::ExternalLinkage);
646 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
650 V = new Argument(Ty);
653 // Remember where this forward reference came from. FIXME, shouldn't we try
654 // to recycle these things??
655 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
658 if (inFunctionScope())
659 InsertValue(V, CurFun.LateResolveValues);
661 InsertValue(V, CurModule.LateResolveValues);
665 /// defineBBVal - This is a definition of a new basic block with the specified
666 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
667 static BasicBlock *defineBBVal(const ValID &ID) {
668 assert(inFunctionScope() && "Can't get basic block at global scope!");
672 // First, see if this was forward referenced
674 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
675 if (BBI != CurFun.BBForwardRefs.end()) {
677 // The forward declaration could have been inserted anywhere in the
678 // function: insert it into the correct place now.
679 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
680 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
682 // We're about to erase the entry, save the key so we can clean it up.
683 ValID Tmp = BBI->first;
685 // Erase the forward ref from the map as its no longer "forward"
686 CurFun.BBForwardRefs.erase(ID);
688 // The key has been removed from the map but so we don't want to leave
689 // strdup'd memory around so destroy it too.
692 // If its a numbered definition, bump the number and set the BB value.
693 if (ID.Type == ValID::LocalID) {
694 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
702 // We haven't seen this BB before and its first mention is a definition.
703 // Just create it and return it.
704 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
705 BB = new BasicBlock(Name, CurFun.CurrentFunction);
706 if (ID.Type == ValID::LocalID) {
707 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
711 ID.destroy(); // Free strdup'd memory
715 /// getBBVal - get an existing BB value or create a forward reference for it.
717 static BasicBlock *getBBVal(const ValID &ID) {
718 assert(inFunctionScope() && "Can't get basic block at global scope!");
722 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
723 if (BBI != CurFun.BBForwardRefs.end()) {
725 } if (ID.Type == ValID::LocalName) {
726 std::string Name = ID.getName();
727 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
729 if (N->getType()->getTypeID() == Type::LabelTyID)
730 BB = cast<BasicBlock>(N);
732 GenerateError("Reference to label '" + Name + "' is actually of type '"+
733 N->getType()->getDescription() + "'");
734 } else if (ID.Type == ValID::LocalID) {
735 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
736 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
737 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
739 GenerateError("Reference to label '%" + utostr(ID.Num) +
740 "' is actually of type '"+
741 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
744 GenerateError("Illegal label reference " + ID.getName());
748 // If its already been defined, return it now.
750 ID.destroy(); // Free strdup'd memory.
754 // Otherwise, this block has not been seen before, create it.
756 if (ID.Type == ValID::LocalName)
758 BB = new BasicBlock(Name, CurFun.CurrentFunction);
760 // Insert it in the forward refs map.
761 CurFun.BBForwardRefs[ID] = BB;
767 //===----------------------------------------------------------------------===//
768 // Code to handle forward references in instructions
769 //===----------------------------------------------------------------------===//
771 // This code handles the late binding needed with statements that reference
772 // values not defined yet... for example, a forward branch, or the PHI node for
775 // This keeps a table (CurFun.LateResolveValues) of all such forward references
776 // and back patchs after we are done.
779 // ResolveDefinitions - If we could not resolve some defs at parsing
780 // time (forward branches, phi functions for loops, etc...) resolve the
784 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
785 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
786 while (!LateResolvers.empty()) {
787 Value *V = LateResolvers.back();
788 LateResolvers.pop_back();
790 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
791 CurModule.PlaceHolderInfo.find(V);
792 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
794 ValID &DID = PHI->second.first;
796 Value *TheRealValue = getExistingVal(V->getType(), DID);
800 V->replaceAllUsesWith(TheRealValue);
802 CurModule.PlaceHolderInfo.erase(PHI);
803 } else if (FutureLateResolvers) {
804 // Functions have their unresolved items forwarded to the module late
806 InsertValue(V, *FutureLateResolvers);
808 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
809 GenerateError("Reference to an invalid definition: '" +DID.getName()+
810 "' of type '" + V->getType()->getDescription() + "'",
814 GenerateError("Reference to an invalid definition: #" +
815 itostr(DID.Num) + " of type '" +
816 V->getType()->getDescription() + "'",
822 LateResolvers.clear();
825 // ResolveTypeTo - A brand new type was just declared. This means that (if
826 // name is not null) things referencing Name can be resolved. Otherwise, things
827 // refering to the number can be resolved. Do this now.
829 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
832 D = ValID::createLocalName(*Name);
834 D = ValID::createLocalID(CurModule.Types.size());
836 std::map<ValID, PATypeHolder>::iterator I =
837 CurModule.LateResolveTypes.find(D);
838 if (I != CurModule.LateResolveTypes.end()) {
839 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
840 CurModule.LateResolveTypes.erase(I);
844 // setValueName - Set the specified value to the name given. The name may be
845 // null potentially, in which case this is a noop. The string passed in is
846 // assumed to be a malloc'd string buffer, and is free'd by this function.
848 static void setValueName(Value *V, std::string *NameStr) {
849 if (!NameStr) return;
850 std::string Name(*NameStr); // Copy string
851 delete NameStr; // Free old string
853 if (V->getType() == Type::VoidTy) {
854 GenerateError("Can't assign name '" + Name+"' to value with void type");
858 assert(inFunctionScope() && "Must be in function scope!");
859 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
860 if (ST.lookup(Name)) {
861 GenerateError("Redefinition of value '" + Name + "' of type '" +
862 V->getType()->getDescription() + "'");
870 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
871 /// this is a declaration, otherwise it is a definition.
872 static GlobalVariable *
873 ParseGlobalVariable(std::string *NameStr,
874 GlobalValue::LinkageTypes Linkage,
875 GlobalValue::VisibilityTypes Visibility,
876 bool isConstantGlobal, const Type *Ty,
877 Constant *Initializer, bool IsThreadLocal) {
878 if (isa<FunctionType>(Ty)) {
879 GenerateError("Cannot declare global vars of function type");
883 const PointerType *PTy = PointerType::get(Ty);
887 Name = *NameStr; // Copy string
888 delete NameStr; // Free old string
891 // See if this global value was forward referenced. If so, recycle the
895 ID = ValID::createGlobalName(Name);
897 ID = ValID::createGlobalID(CurModule.Values.size());
900 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
901 // Move the global to the end of the list, from whereever it was
902 // previously inserted.
903 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
904 CurModule.CurrentModule->getGlobalList().remove(GV);
905 CurModule.CurrentModule->getGlobalList().push_back(GV);
906 GV->setInitializer(Initializer);
907 GV->setLinkage(Linkage);
908 GV->setVisibility(Visibility);
909 GV->setConstant(isConstantGlobal);
910 GV->setThreadLocal(IsThreadLocal);
911 InsertValue(GV, CurModule.Values);
915 // If this global has a name
917 // if the global we're parsing has an initializer (is a definition) and
918 // has external linkage.
919 if (Initializer && Linkage != GlobalValue::InternalLinkage)
920 // If there is already a global with external linkage with this name
921 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
922 // If we allow this GVar to get created, it will be renamed in the
923 // symbol table because it conflicts with an existing GVar. We can't
924 // allow redefinition of GVars whose linking indicates that their name
925 // must stay the same. Issue the error.
926 GenerateError("Redefinition of global variable named '" + Name +
927 "' of type '" + Ty->getDescription() + "'");
932 // Otherwise there is no existing GV to use, create one now.
934 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
935 CurModule.CurrentModule, IsThreadLocal);
936 GV->setVisibility(Visibility);
937 InsertValue(GV, CurModule.Values);
941 // setTypeName - Set the specified type to the name given. The name may be
942 // null potentially, in which case this is a noop. The string passed in is
943 // assumed to be a malloc'd string buffer, and is freed by this function.
945 // This function returns true if the type has already been defined, but is
946 // allowed to be redefined in the specified context. If the name is a new name
947 // for the type plane, it is inserted and false is returned.
948 static bool setTypeName(const Type *T, std::string *NameStr) {
949 assert(!inFunctionScope() && "Can't give types function-local names!");
950 if (NameStr == 0) return false;
952 std::string Name(*NameStr); // Copy string
953 delete NameStr; // Free old string
955 // We don't allow assigning names to void type
956 if (T == Type::VoidTy) {
957 GenerateError("Can't assign name '" + Name + "' to the void type");
961 // Set the type name, checking for conflicts as we do so.
962 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
964 if (AlreadyExists) { // Inserting a name that is already defined???
965 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
966 assert(Existing && "Conflict but no matching type?!");
968 // There is only one case where this is allowed: when we are refining an
969 // opaque type. In this case, Existing will be an opaque type.
970 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
971 // We ARE replacing an opaque type!
972 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
976 // Otherwise, this is an attempt to redefine a type. That's okay if
977 // the redefinition is identical to the original. This will be so if
978 // Existing and T point to the same Type object. In this one case we
979 // allow the equivalent redefinition.
980 if (Existing == T) return true; // Yes, it's equal.
982 // Any other kind of (non-equivalent) redefinition is an error.
983 GenerateError("Redefinition of type named '" + Name + "' of type '" +
984 T->getDescription() + "'");
990 //===----------------------------------------------------------------------===//
991 // Code for handling upreferences in type names...
994 // TypeContains - Returns true if Ty directly contains E in it.
996 static bool TypeContains(const Type *Ty, const Type *E) {
997 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
998 E) != Ty->subtype_end();
1002 struct UpRefRecord {
1003 // NestingLevel - The number of nesting levels that need to be popped before
1004 // this type is resolved.
1005 unsigned NestingLevel;
1007 // LastContainedTy - This is the type at the current binding level for the
1008 // type. Every time we reduce the nesting level, this gets updated.
1009 const Type *LastContainedTy;
1011 // UpRefTy - This is the actual opaque type that the upreference is
1012 // represented with.
1013 OpaqueType *UpRefTy;
1015 UpRefRecord(unsigned NL, OpaqueType *URTy)
1016 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1020 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1021 static std::vector<UpRefRecord> UpRefs;
1023 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1024 /// called. It loops through the UpRefs vector, which is a list of the
1025 /// currently active types. For each type, if the up reference is contained in
1026 /// the newly completed type, we decrement the level count. When the level
1027 /// count reaches zero, the upreferenced type is the type that is passed in:
1028 /// thus we can complete the cycle.
1030 static PATypeHolder HandleUpRefs(const Type *ty) {
1031 // If Ty isn't abstract, or if there are no up-references in it, then there is
1032 // nothing to resolve here.
1033 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1035 PATypeHolder Ty(ty);
1036 UR_OUT("Type '" << Ty->getDescription() <<
1037 "' newly formed. Resolving upreferences.\n" <<
1038 UpRefs.size() << " upreferences active!\n");
1040 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1041 // to zero), we resolve them all together before we resolve them to Ty. At
1042 // the end of the loop, if there is anything to resolve to Ty, it will be in
1044 OpaqueType *TypeToResolve = 0;
1046 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1047 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1048 << UpRefs[i].second->getDescription() << ") = "
1049 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1050 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1051 // Decrement level of upreference
1052 unsigned Level = --UpRefs[i].NestingLevel;
1053 UpRefs[i].LastContainedTy = Ty;
1054 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1055 if (Level == 0) { // Upreference should be resolved!
1056 if (!TypeToResolve) {
1057 TypeToResolve = UpRefs[i].UpRefTy;
1059 UR_OUT(" * Resolving upreference for "
1060 << UpRefs[i].second->getDescription() << "\n";
1061 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1062 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1063 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1064 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1066 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1067 --i; // Do not skip the next element...
1072 if (TypeToResolve) {
1073 UR_OUT(" * Resolving upreference for "
1074 << UpRefs[i].second->getDescription() << "\n";
1075 std::string OldName = TypeToResolve->getDescription());
1076 TypeToResolve->refineAbstractTypeTo(Ty);
1082 //===----------------------------------------------------------------------===//
1083 // RunVMAsmParser - Define an interface to this parser
1084 //===----------------------------------------------------------------------===//
1086 static Module* RunParser(Module * M);
1088 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1091 CurFilename = Filename;
1092 return RunParser(new Module(CurFilename));
1095 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1096 set_scan_string(AsmString);
1098 CurFilename = "from_memory";
1100 return RunParser(new Module (CurFilename));
1102 return RunParser(M);
1107 #line 963 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
1109 llvm::Module *ModuleVal;
1110 llvm::Function *FunctionVal;
1111 llvm::BasicBlock *BasicBlockVal;
1112 llvm::TerminatorInst *TermInstVal;
1113 llvm::Instruction *InstVal;
1114 llvm::Constant *ConstVal;
1116 const llvm::Type *PrimType;
1117 std::list<llvm::PATypeHolder> *TypeList;
1118 llvm::PATypeHolder *TypeVal;
1119 llvm::Value *ValueVal;
1120 std::vector<llvm::Value*> *ValueList;
1121 llvm::ArgListType *ArgList;
1122 llvm::TypeWithAttrs TypeWithAttrs;
1123 llvm::TypeWithAttrsList *TypeWithAttrsList;
1124 llvm::ValueRefList *ValueRefList;
1126 // Represent the RHS of PHI node
1127 std::list<std::pair<llvm::Value*,
1128 llvm::BasicBlock*> > *PHIList;
1129 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1130 std::vector<llvm::Constant*> *ConstVector;
1132 llvm::GlobalValue::LinkageTypes Linkage;
1133 llvm::GlobalValue::VisibilityTypes Visibility;
1134 uint16_t ParamAttrs;
1135 llvm::APInt *APIntVal;
1143 std::string *StrVal; // This memory must be deleted
1144 llvm::ValID ValIDVal;
1146 llvm::Instruction::BinaryOps BinaryOpVal;
1147 llvm::Instruction::TermOps TermOpVal;
1148 llvm::Instruction::MemoryOps MemOpVal;
1149 llvm::Instruction::CastOps CastOpVal;
1150 llvm::Instruction::OtherOps OtherOpVal;
1151 llvm::ICmpInst::Predicate IPredicate;
1152 llvm::FCmpInst::Predicate FPredicate;
1165 #define YYFLAG -32768
1166 #define YYNTBASE 160
1168 #define YYTRANSLATE(x) ((unsigned)(x) <= 399 ? yytranslate[x] : 241)
1170 static const short yytranslate[] = { 0,
1171 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 150,
1175 151, 148, 2, 147, 2, 2, 2, 2, 2, 2,
1176 2, 2, 2, 2, 2, 2, 2, 2, 2, 155,
1177 146, 156, 2, 2, 2, 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 152, 149, 154, 2, 2, 2, 2, 2, 159, 2,
1181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1182 2, 2, 2, 2, 2, 2, 2, 2, 2, 153,
1183 2, 2, 157, 2, 158, 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, 2, 2, 2, 2, 2,
1191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1196 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1197 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1198 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1199 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1200 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1201 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1202 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1203 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1204 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1205 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1206 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1207 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1208 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1209 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1210 137, 138, 139, 140, 141, 142, 143, 144, 145
1214 static const short yyprhs[] = { 0,
1215 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1216 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1217 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1218 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1219 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1220 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1221 120, 122, 124, 126, 127, 130, 131, 133, 135, 137,
1222 138, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1223 158, 160, 162, 164, 165, 167, 169, 170, 172, 174,
1224 176, 178, 179, 181, 183, 184, 186, 188, 190, 192,
1225 194, 197, 199, 201, 203, 205, 207, 209, 211, 213,
1226 215, 216, 219, 221, 223, 225, 227, 228, 231, 232,
1227 235, 236, 240, 243, 244, 246, 247, 251, 253, 256,
1228 258, 260, 262, 264, 266, 268, 270, 272, 274, 277,
1229 279, 282, 288, 294, 300, 306, 310, 313, 319, 324,
1230 327, 329, 331, 333, 337, 339, 343, 345, 346, 348,
1231 352, 357, 361, 365, 370, 375, 379, 386, 392, 395,
1232 398, 401, 404, 407, 410, 413, 416, 419, 422, 425,
1233 428, 435, 441, 450, 457, 464, 472, 480, 487, 496,
1234 505, 509, 511, 513, 515, 517, 518, 521, 528, 530,
1235 531, 533, 536, 537, 541, 542, 546, 550, 554, 558,
1236 559, 567, 568, 577, 578, 587, 593, 596, 600, 602,
1237 606, 610, 614, 618, 620, 621, 627, 631, 633, 637,
1238 639, 640, 650, 652, 654, 659, 661, 663, 666, 670,
1239 671, 673, 675, 677, 679, 681, 683, 685, 687, 689,
1240 693, 695, 701, 703, 705, 707, 709, 711, 713, 716,
1241 719, 722, 726, 729, 730, 732, 735, 738, 742, 752,
1242 762, 771, 786, 788, 790, 797, 803, 806, 813, 821,
1243 825, 831, 832, 833, 837, 840, 842, 848, 854, 861,
1244 868, 873, 880, 885, 890, 897, 904, 907, 916, 918,
1245 920, 921, 925, 932, 936, 943, 946, 952, 960
1248 static const short yyrhs[] = { 73,
1249 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1250 0, 79, 0, 80, 0, 81, 0, 85, 0, 86,
1251 0, 87, 0, 82, 0, 83, 0, 84, 0, 116,
1252 0, 117, 0, 118, 0, 119, 0, 120, 0, 121,
1253 0, 122, 0, 123, 0, 124, 0, 125, 0, 126,
1254 0, 127, 0, 90, 0, 91, 0, 92, 0, 93,
1255 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
1256 0, 99, 0, 100, 0, 101, 0, 102, 0, 103,
1257 0, 104, 0, 105, 0, 106, 0, 107, 0, 108,
1258 0, 109, 0, 96, 0, 97, 0, 98, 0, 99,
1259 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1260 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1261 0, 24, 0, 167, 0, 0, 167, 146, 0, 0,
1262 20, 0, 23, 0, 172, 0, 0, 170, 146, 0,
1263 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1264 46, 0, 48, 0, 50, 0, 0, 143, 0, 144,
1265 0, 145, 0, 0, 46, 0, 48, 0, 0, 42,
1266 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1267 42, 0, 0, 61, 0, 62, 0, 63, 0, 64,
1268 0, 65, 0, 60, 4, 0, 135, 0, 117, 0,
1269 134, 0, 118, 0, 137, 0, 138, 0, 140, 0,
1270 141, 0, 142, 0, 0, 181, 180, 0, 136, 0,
1271 139, 0, 135, 0, 134, 0, 0, 183, 182, 0,
1272 0, 53, 4, 0, 0, 147, 53, 4, 0, 34,
1273 22, 0, 0, 186, 0, 0, 147, 189, 188, 0,
1274 186, 0, 53, 4, 0, 11, 0, 12, 0, 13,
1275 0, 16, 0, 15, 0, 14, 0, 17, 0, 49,
1276 0, 190, 0, 191, 148, 0, 225, 0, 149, 4,
1277 0, 191, 150, 195, 151, 183, 0, 10, 150, 195,
1278 151, 183, 0, 152, 4, 153, 191, 154, 0, 155,
1279 4, 153, 191, 156, 0, 157, 196, 158, 0, 157,
1280 158, 0, 155, 157, 196, 158, 156, 0, 155, 157,
1281 158, 156, 0, 191, 181, 0, 191, 0, 10, 0,
1282 192, 0, 194, 147, 192, 0, 194, 0, 194, 147,
1283 39, 0, 39, 0, 0, 191, 0, 196, 147, 191,
1284 0, 191, 152, 199, 154, 0, 191, 152, 154, 0,
1285 191, 159, 22, 0, 191, 155, 199, 156, 0, 191,
1286 157, 199, 158, 0, 191, 157, 158, 0, 191, 155,
1287 157, 199, 158, 156, 0, 191, 155, 157, 158, 156,
1288 0, 191, 40, 0, 191, 41, 0, 191, 225, 0,
1289 191, 198, 0, 191, 25, 0, 165, 3, 0, 165,
1290 5, 0, 165, 4, 0, 165, 6, 0, 11, 26,
1291 0, 11, 27, 0, 166, 9, 0, 162, 150, 197,
1292 38, 191, 151, 0, 115, 150, 197, 236, 151, 0,
1293 129, 150, 197, 147, 197, 147, 197, 151, 0, 160,
1294 150, 197, 147, 197, 151, 0, 161, 150, 197, 147,
1295 197, 151, 0, 88, 163, 150, 197, 147, 197, 151,
1296 0, 89, 164, 150, 197, 147, 197, 151, 0, 131,
1297 150, 197, 147, 197, 151, 0, 132, 150, 197, 147,
1298 197, 147, 197, 151, 0, 133, 150, 197, 147, 197,
1299 147, 197, 151, 0, 199, 147, 197, 0, 197, 0,
1300 32, 0, 33, 0, 37, 0, 0, 193, 225, 0,
1301 121, 150, 202, 38, 191, 151, 0, 204, 0, 0,
1302 205, 0, 204, 205, 0, 0, 31, 206, 221, 0,
1303 0, 30, 207, 222, 0, 58, 57, 211, 0, 169,
1304 18, 191, 0, 169, 18, 10, 0, 0, 171, 175,
1305 201, 200, 197, 208, 188, 0, 0, 171, 173, 175,
1306 201, 200, 197, 209, 188, 0, 0, 171, 174, 175,
1307 201, 200, 191, 210, 188, 0, 171, 175, 35, 178,
1308 202, 0, 51, 212, 0, 54, 146, 213, 0, 22,
1309 0, 52, 146, 22, 0, 66, 146, 22, 0, 152,
1310 214, 154, 0, 214, 147, 22, 0, 22, 0, 0,
1311 215, 147, 191, 181, 168, 0, 191, 181, 168, 0,
1312 215, 0, 215, 147, 39, 0, 39, 0, 0, 179,
1313 193, 170, 150, 216, 151, 183, 187, 184, 0, 28,
1314 0, 157, 0, 177, 175, 217, 218, 0, 29, 0,
1315 158, 0, 228, 220, 0, 176, 175, 217, 0, 0,
1316 59, 0, 3, 0, 4, 0, 9, 0, 26, 0,
1317 27, 0, 40, 0, 41, 0, 25, 0, 155, 199,
1318 156, 0, 198, 0, 57, 223, 22, 147, 22, 0,
1319 7, 0, 8, 0, 167, 0, 170, 0, 225, 0,
1320 224, 0, 191, 226, 0, 228, 229, 0, 219, 229,
1321 0, 230, 169, 231, 0, 230, 233, 0, 0, 21,
1322 0, 67, 227, 0, 67, 10, 0, 68, 17, 226,
1323 0, 68, 11, 226, 147, 17, 226, 147, 17, 226,
1324 0, 69, 165, 226, 147, 17, 226, 152, 232, 154,
1325 0, 69, 165, 226, 147, 17, 226, 152, 154, 0,
1326 70, 179, 193, 226, 150, 235, 151, 183, 38, 17,
1327 226, 71, 17, 226, 0, 71, 0, 72, 0, 232,
1328 165, 224, 147, 17, 226, 0, 165, 224, 147, 17,
1329 226, 0, 169, 238, 0, 191, 152, 226, 147, 226,
1330 154, 0, 234, 147, 152, 226, 147, 226, 154, 0,
1331 191, 226, 181, 0, 235, 147, 191, 226, 181, 0,
1332 0, 0, 236, 147, 227, 0, 56, 55, 0, 55,
1333 0, 160, 191, 226, 147, 226, 0, 161, 191, 226,
1334 147, 226, 0, 88, 163, 191, 226, 147, 226, 0,
1335 89, 164, 191, 226, 147, 226, 0, 162, 227, 38,
1336 191, 0, 129, 227, 147, 227, 147, 227, 0, 130,
1337 227, 147, 191, 0, 131, 227, 147, 227, 0, 132,
1338 227, 147, 227, 147, 227, 0, 133, 227, 147, 227,
1339 147, 227, 0, 128, 234, 0, 237, 179, 193, 226,
1340 150, 235, 151, 183, 0, 240, 0, 36, 0, 0,
1341 110, 191, 185, 0, 110, 191, 147, 11, 226, 185,
1342 0, 111, 191, 185, 0, 111, 191, 147, 11, 226,
1343 185, 0, 112, 227, 0, 239, 113, 191, 226, 185,
1344 0, 239, 114, 227, 147, 191, 226, 185, 0, 115,
1351 static const short yyrline[] = { 0,
1352 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1123,
1353 1123, 1123, 1123, 1123, 1123, 1124, 1124, 1124, 1124, 1124,
1354 1124, 1124, 1125, 1125, 1125, 1125, 1125, 1128, 1128, 1129,
1355 1129, 1130, 1130, 1131, 1131, 1132, 1132, 1136, 1136, 1137,
1356 1137, 1138, 1138, 1139, 1139, 1140, 1140, 1141, 1141, 1142,
1357 1142, 1143, 1144, 1149, 1150, 1150, 1150, 1150, 1150, 1152,
1358 1152, 1152, 1153, 1153, 1157, 1161, 1166, 1166, 1168, 1169,
1359 1174, 1180, 1181, 1182, 1183, 1184, 1188, 1189, 1190, 1194,
1360 1195, 1196, 1197, 1201, 1202, 1203, 1207, 1208, 1209, 1210,
1361 1211, 1215, 1216, 1217, 1220, 1220, 1221, 1222, 1223, 1224,
1362 1225, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241,
1363 1244, 1245, 1250, 1251, 1252, 1253, 1256, 1257, 1264, 1264,
1364 1271, 1271, 1280, 1288, 1288, 1294, 1294, 1296, 1301, 1314,
1365 1314, 1314, 1314, 1314, 1314, 1314, 1317, 1321, 1325, 1332,
1366 1337, 1345, 1375, 1406, 1411, 1423, 1433, 1437, 1447, 1454,
1367 1461, 1468, 1473, 1478, 1485, 1486, 1493, 1500, 1508, 1514,
1368 1526, 1554, 1570, 1597, 1625, 1651, 1671, 1697, 1717, 1729,
1369 1736, 1802, 1812, 1822, 1828, 1838, 1844, 1854, 1859, 1864,
1370 1872, 1884, 1906, 1914, 1920, 1931, 1936, 1941, 1947, 1953,
1371 1962, 1966, 1974, 1974, 1977, 1977, 1980, 1992, 2013, 2018,
1372 2026, 2027, 2031, 2031, 2035, 2035, 2038, 2041, 2065, 2076,
1373 2083, 2086, 2092, 2095, 2102, 2106, 2125, 2128, 2134, 2144,
1374 2148, 2153, 2155, 2160, 2165, 2174, 2184, 2195, 2199, 2208,
1375 2217, 2222, 2343, 2343, 2345, 2354, 2354, 2356, 2361, 2373,
1376 2377, 2382, 2386, 2390, 2394, 2398, 2402, 2406, 2410, 2414,
1377 2439, 2443, 2453, 2457, 2461, 2466, 2473, 2473, 2479, 2488,
1378 2492, 2501, 2510, 2519, 2523, 2530, 2534, 2538, 2543, 2553,
1379 2572, 2581, 2661, 2665, 2672, 2683, 2696, 2706, 2717, 2727,
1380 2736, 2745, 2748, 2749, 2756, 2760, 2765, 2786, 2803, 2817,
1381 2831, 2843, 2851, 2858, 2864, 2870, 2876, 2891, 2976, 2981,
1382 2985, 2992, 2999, 3007, 3014, 3022, 3030, 3044, 3061
1387 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1389 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1390 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1391 "VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1392 "LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1393 "ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1394 "GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1395 "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1396 "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL",
1397 "TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1398 "X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE",
1399 "UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM",
1400 "FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT",
1401 "SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD",
1402 "UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC",
1403 "ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI",
1404 "INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT",
1405 "SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET","NOUNWIND","NOALIAS",
1406 "BYVAL","NEST","DEFAULT","HIDDEN","PROTECTED","'='","','","'*'","'\\\\'","'('",
1407 "')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps",
1408 "CastOps","IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName",
1409 "OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage",
1410 "GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage",
1411 "AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs",
1412 "OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1413 "PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1414 "ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1415 "Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1416 "LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1417 "FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1418 "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1419 "BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","IndexList","OptTailCall",
1420 "InstVal","OptVolatile","MemoryInst", NULL
1424 static const short yyr1[] = { 0,
1425 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1426 161, 161, 161, 161, 161, 162, 162, 162, 162, 162,
1427 162, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1428 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
1429 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1430 164, 164, 164, 165, 166, 166, 166, 166, 166, 167,
1431 167, 167, 168, 168, 169, 169, 170, 170, 171, 171,
1432 172, 173, 173, 173, 173, 173, 174, 174, 174, 175,
1433 175, 175, 175, 176, 176, 176, 177, 177, 177, 177,
1434 177, 178, 178, 178, 179, 179, 179, 179, 179, 179,
1435 179, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1436 181, 181, 182, 182, 182, 182, 183, 183, 184, 184,
1437 185, 185, 186, 187, 187, 188, 188, 189, 189, 190,
1438 190, 190, 190, 190, 190, 190, 191, 191, 191, 191,
1439 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1440 193, 193, 194, 194, 195, 195, 195, 195, 196, 196,
1441 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1442 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1443 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1444 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1445 204, 204, 206, 205, 207, 205, 205, 205, 205, 208,
1446 205, 209, 205, 210, 205, 205, 205, 205, 211, 212,
1447 212, 213, 214, 214, 214, 215, 215, 216, 216, 216,
1448 216, 217, 218, 218, 219, 220, 220, 221, 222, 223,
1449 223, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1450 224, 224, 225, 225, 225, 225, 226, 226, 227, 228,
1451 228, 229, 230, 230, 230, 231, 231, 231, 231, 231,
1452 231, 231, 231, 231, 232, 232, 233, 234, 234, 235,
1453 235, 235, 236, 236, 237, 237, 238, 238, 238, 238,
1454 238, 238, 238, 238, 238, 238, 238, 238, 238, 239,
1455 239, 240, 240, 240, 240, 240, 240, 240, 240
1458 static const short yyr2[] = { 0,
1459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1460 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1461 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1462 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1463 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1464 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1465 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1466 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1467 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1468 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1469 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1470 0, 2, 1, 1, 1, 1, 0, 2, 0, 2,
1471 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
1472 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1473 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1474 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1475 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1477 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1478 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1479 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1480 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1481 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1482 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1483 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1484 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1485 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1486 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1487 5, 0, 0, 3, 2, 1, 5, 5, 6, 6,
1488 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
1489 0, 3, 6, 3, 6, 2, 5, 7, 4
1492 static const short yydefact[] = { 70,
1493 60, 67, 61, 68, 62, 205, 203, 0, 0, 0,
1494 0, 0, 0, 80, 69, 70, 201, 84, 87, 0,
1495 0, 217, 0, 0, 65, 0, 71, 72, 74, 73,
1496 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1497 196, 202, 85, 86, 80, 206, 88, 89, 90, 91,
1498 80, 264, 204, 264, 0, 0, 225, 218, 219, 207,
1499 253, 254, 209, 130, 131, 132, 135, 134, 133, 136,
1500 137, 0, 0, 0, 0, 255, 256, 138, 208, 140,
1501 196, 196, 92, 195, 0, 95, 95, 265, 261, 66,
1502 236, 237, 238, 260, 220, 221, 224, 0, 158, 141,
1503 0, 0, 0, 0, 147, 159, 0, 139, 158, 0,
1504 0, 94, 93, 0, 193, 194, 0, 0, 96, 97,
1505 98, 99, 100, 0, 239, 0, 301, 263, 0, 222,
1506 157, 111, 153, 155, 0, 0, 0, 0, 0, 0,
1507 146, 0, 0, 0, 152, 0, 151, 0, 216, 130,
1508 131, 132, 135, 134, 133, 0, 0, 0, 210, 101,
1509 0, 233, 234, 235, 300, 286, 0, 0, 0, 0,
1510 95, 273, 274, 1, 2, 3, 4, 5, 6, 7,
1511 8, 9, 13, 14, 15, 10, 11, 12, 0, 0,
1512 0, 0, 0, 0, 16, 17, 18, 19, 20, 21,
1513 22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
1514 0, 0, 0, 0, 0, 262, 95, 277, 0, 299,
1515 223, 150, 0, 117, 0, 0, 149, 0, 160, 117,
1516 212, 214, 0, 197, 178, 179, 174, 176, 175, 177,
1517 180, 173, 169, 170, 0, 0, 0, 0, 0, 0,
1518 0, 0, 0, 0, 0, 0, 0, 0, 172, 171,
1519 126, 0, 285, 267, 0, 266, 0, 0, 54, 0,
1520 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1521 37, 0, 52, 53, 48, 49, 50, 51, 38, 39,
1522 40, 41, 42, 43, 44, 45, 46, 47, 0, 121,
1523 121, 306, 0, 0, 297, 0, 0, 0, 0, 0,
1524 0, 0, 0, 0, 0, 0, 103, 105, 104, 102,
1525 106, 107, 108, 109, 110, 112, 156, 154, 143, 144,
1526 145, 148, 142, 126, 126, 0, 0, 0, 0, 0,
1527 0, 0, 0, 162, 192, 0, 0, 0, 166, 0,
1528 163, 0, 0, 0, 0, 211, 231, 242, 243, 244,
1529 249, 245, 246, 247, 248, 240, 0, 251, 258, 257,
1530 259, 0, 268, 0, 0, 0, 0, 0, 302, 0,
1531 304, 283, 0, 0, 0, 0, 0, 0, 0, 0,
1532 0, 0, 0, 0, 0, 116, 115, 113, 114, 118,
1533 213, 215, 0, 0, 0, 283, 0, 0, 0, 0,
1534 0, 161, 147, 159, 0, 164, 165, 0, 0, 0,
1535 0, 0, 128, 126, 230, 111, 228, 0, 241, 0,
1536 0, 0, 0, 0, 0, 0, 0, 0, 0, 309,
1537 0, 0, 0, 293, 294, 0, 0, 0, 0, 291,
1538 0, 121, 0, 0, 0, 0, 0, 0, 0, 0,
1539 0, 191, 168, 0, 0, 0, 0, 123, 129, 127,
1540 64, 0, 117, 0, 250, 0, 0, 282, 0, 0,
1541 121, 122, 121, 0, 0, 0, 0, 0, 0, 287,
1542 288, 282, 0, 307, 0, 198, 0, 0, 182, 0,
1543 0, 0, 0, 167, 0, 0, 0, 63, 227, 229,
1544 111, 124, 0, 0, 0, 0, 0, 289, 290, 303,
1545 305, 284, 0, 0, 292, 295, 296, 0, 121, 0,
1546 0, 0, 188, 0, 0, 184, 185, 181, 64, 125,
1547 119, 252, 0, 0, 111, 0, 117, 278, 0, 117,
1548 308, 186, 187, 0, 0, 0, 226, 0, 232, 0,
1549 271, 0, 0, 280, 0, 0, 279, 298, 183, 189,
1550 190, 120, 269, 0, 270, 0, 111, 0, 0, 0,
1551 281, 0, 0, 0, 0, 276, 0, 0, 275, 0,
1555 static const short yydefgoto[] = { 256,
1556 257, 258, 282, 299, 156, 157, 76, 509, 12, 77,
1557 14, 15, 39, 40, 41, 45, 51, 114, 124, 326,
1558 222, 400, 329, 559, 379, 423, 541, 356, 424, 78,
1559 158, 133, 148, 134, 135, 107, 345, 368, 346, 117,
1560 85, 149, 592, 16, 17, 19, 18, 261, 334, 335,
1561 60, 22, 58, 98, 427, 428, 125, 164, 52, 93,
1562 53, 46, 430, 369, 80, 371, 266, 54, 89, 90,
1563 216, 563, 128, 305, 517, 440, 217, 218, 219, 220
1566 static const short yypact[] = { 42,
1567 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -21, -131, 60,
1568 -93, 105, -22, 182,-32768, 525,-32768, 46, 168, -12,
1569 19,-32768, 1, 152,-32768, 1277,-32768,-32768,-32768,-32768,
1570 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 90, 90,
1571 100,-32768,-32768,-32768, 90,-32768,-32768,-32768,-32768,-32768,
1572 90, 186,-32768, 12, 187, 201, 209,-32768,-32768,-32768,
1573 -32768,-32768, 93,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1574 -32768, 252, 254, 2, 907,-32768,-32768,-32768, 13,-32768,
1575 225, 225, 150,-32768, 76, 116, 116,-32768,-32768, 108,
1576 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -79, 1027,-32768,
1577 111, 114, 947, 93,-32768, 13, -104,-32768, 1027, 76,
1578 76,-32768,-32768, 1067,-32768,-32768, 1299, 266,-32768,-32768,
1579 -32768,-32768,-32768, 1330,-32768, -16, 1572,-32768, 256,-32768,
1580 -32768, 13,-32768, 139, 144, 1370, 1370, 132, -95, 1370,
1581 -32768, 145, 1299, 1370, 93, 147, 13, 311,-32768, 43,
1582 290, 293, 298, 299, 302, 247, 303, 724,-32768,-32768,
1583 35,-32768,-32768,-32768,-32768,-32768, 258, 1450, 70, 305,
1584 116,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1585 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 317, 405,
1586 1370, 1370, 1370, 1370,-32768,-32768,-32768,-32768,-32768,-32768,
1587 -32768,-32768,-32768,-32768,-32768,-32768, 1370, 1370, 1370, 1370,
1588 1370, 1370, 1370, 1370, 1370,-32768, 116,-32768, 34,-32768,
1589 -32768, 131, 1107,-32768, 6, -46,-32768, 164, 13,-32768,
1590 -32768, 13, 1067,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1591 -32768,-32768,-32768,-32768, 317, 405, 173, 178, 179, 189,
1592 192, 1179, 1481, 987, 314, 193, 197, 198,-32768,-32768,
1593 202, 203,-32768, 93, 565,-32768, 699, 699,-32768, 699,
1594 1330,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1595 -32768, 1370,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1596 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1370, 113,
1597 137,-32768, 565, -10, 205, 207, 208, 210, 218, 219,
1598 565, 565, 330, 1330, 1370, 1370,-32768,-32768,-32768,-32768,
1599 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 106,-32768,
1600 -32768,-32768, 106, 202, 202, 331, 220, 221, 1299, 1299,
1601 1299, 1299, 1299,-32768,-32768, -41, 1005, -61,-32768, -91,
1602 -32768, 1299, 1299, 1299, -13,-32768, 1219,-32768,-32768,-32768,
1603 -32768,-32768,-32768,-32768,-32768, 313, 1299,-32768,-32768,-32768,
1604 -32768, 226,-32768, 227, 699, 565, 565, 23,-32768, 24,
1605 -32768,-32768, 699, 223, 1370, 1370, 1370, 1370, 1370, 232,
1606 233, 1370, 699, 565, 234,-32768,-32768,-32768,-32768,-32768,
1607 -32768,-32768, 1370, 1299, 1299,-32768, 235, 236, 237, 239,
1608 1299,-32768, 231, 724, -76,-32768,-32768, 241, 242, 352,
1609 369, 388,-32768, 202,-32768, 13, 246, 243,-32768, 374,
1610 -59, 380, 385, 253, 257, 270, 699, 414, 699, 272,
1611 273, 699, 278, 13,-32768, 280, 282, 699, 699, 13,
1612 283, 287, 1370, -112, 288, 289, -33, 1299, 1299, 1299,
1613 1299,-32768,-32768, 294, 1299, 1299, 1370,-32768,-32768,-32768,
1614 79, 1259,-32768, 292,-32768, 699, 699, 1370, 699, 699,
1615 287,-32768, 287, 1370, 699, 307, 1370, 1370, 1370,-32768,
1616 -32768, 1370, 392,-32768, 565,-32768, 1299, 1299,-32768, 308,
1617 295, 309, 310,-32768, 301, 315, 7,-32768,-32768,-32768,
1618 13, 10, 427, 318, 306, 565, 52,-32768,-32768,-32768,
1619 -32768,-32768, 316, 699,-32768,-32768,-32768, 71, 287, 322,
1620 325, 1299,-32768, 1299, 1299,-32768,-32768,-32768, 79,-32768,
1621 407,-32768, 444, -4,-32768, 1370,-32768,-32768, 323,-32768,
1622 -32768,-32768,-32768, 327, 328, 329,-32768, 464,-32768, 699,
1623 -32768, 859, -3, 131, 565, -14,-32768, 106,-32768,-32768,
1624 -32768,-32768,-32768, 334,-32768, 859,-32768, 452, 465, 336,
1625 131, 699, 699, 468, 416,-32768, 699, 471,-32768, 699,
1626 -32768, 490, 491,-32768
1629 static const short yypgoto[] = { 365,
1630 366, 367, 255, 251, -168,-32768, 0, -40, 408, 14,
1631 -32768,-32768,-32768,-32768, 40,-32768,-32768,-32768, -158,-32768,
1632 -406,-32768, -226,-32768, -290, 3,-32768, -317,-32768,-32768,
1633 -25, 296, -119,-32768, 409, 413, -60, -155, -231, 166,
1634 119, 284,-32768,-32768, 504,-32768,-32768,-32768,-32768,-32768,
1635 -32768,-32768,-32768,-32768,-32768,-32768, 435,-32768,-32768,-32768,
1636 -32768,-32768,-32768, -525, -139, 47, -183,-32768, 474,-32768,
1637 -32768,-32768,-32768,-32768, 37, 124,-32768,-32768,-32768,-32768
1644 static const short yytable[] = { 11,
1645 79, 270, 259, 333, 161, 102, 269, 269, 234, 302,
1646 381, 162, 271, 13, 23, 11, 401, 402, 260, 471,
1647 421, 348, 350, 578, 306, 307, 308, 309, 310, 13,
1648 20, 313, 88, 437, 439, 108, 574, 109, 496, 422,
1649 91, -200, 140, 421, 21, -54, -54, -54, -54, 106,
1650 580, 140, 25, 141, 2, 411, 159, 4, 314, -66,
1651 1, 2, 228, 3, 4, 5, 417, 129, 235, 236,
1652 411, 6, 7, 132, 130, 438, 438, 106, 81, 82,
1653 267, 464, 231, 132, 86, 411, 268, 411, 147, 11,
1654 87, 43, 8, 44, 416, 9, 475, 1, 147, 10,
1655 3, 108, 5, 109, 539, 411, 470, 115, 116, 331,
1656 225, 226, 412, 484, 229, 415, 24, 499, 232, 396,
1657 397, 398, 26, 27, 399, 370, 1, 370, 370, 3,
1658 370, 5, 395, 55, 83, 431, 84, 108, 564, 109,
1659 163, 383, 265, 396, 397, 398, 315, 316, 399, 561,
1660 575, 375, 57, 108, 108, 109, 109, 538, 103, 330,
1661 108, 494, 109, 370, 56, 300, 301, 265, 303, 92,
1662 581, 370, 370, 59, 262, 118, 119, 120, 121, 122,
1663 123, 304, 265, 265, 265, 265, 265, 311, 312, 265,
1664 520, 112, 521, 113, 393, 317, 318, 132, 546, 110,
1665 111, 443, 547, 445, 446, 447, 88, 147, 95, 47,
1666 48, 49, 319, 320, 50, 321, 322, 546, 323, 324,
1667 325, 550, 96, 28, 29, 30, 31, 32, 33, 34,
1668 97, 35, 36, 37, 38, 370, 370, 370, 551, 396,
1669 397, 398, 99, 370, 399, 147, 512, 317, 318, 237,
1670 238, 239, 240, 370, 370, 100, 376, 101, 259, 378,
1671 108, 84, 109, 136, 319, 320, 137, 321, 322, 160,
1672 323, 324, 325, 377, 260, 143, 144, 221, 406, 407,
1673 408, 409, 410, 380, 108, 223, 109, 227, 147, 394,
1674 265, 418, 419, 420, 224, 230, 233, 370, -55, 370,
1675 522, -56, 370, 525, 526, 527, -59, -58, 370, 370,
1676 -57, 241, 263, 372, 373, 269, 374, 61, 62, 332,
1677 566, 414, 339, 568, 36, 37, 38, 340, 341, 1,
1678 2, 426, 3, 4, 5, 351, 370, 370, 342, 370,
1679 370, 343, 352, 455, 456, 370, 353, 354, 355, 382,
1680 462, 384, 357, 385, 386, 370, 387, 390, 391, 265,
1681 444, 265, 265, 265, 388, 389, 450, 392, 403, 404,
1682 405, 429, 432, 433, 442, 562, 370, 454, 448, 449,
1683 453, 458, 459, 460, 370, 461, 463, 465, 466, 467,
1684 468, 469, 472, 473, 576, 474, 476, 500, 501, 502,
1685 503, 477, 478, 479, 505, 506, 272, 273, 274, 275,
1686 276, 277, 278, 279, 280, 281, 480, 482, 484, 485,
1687 370, 434, 435, 436, 487, 370, 488, 495, 489, 441,
1688 283, 284, 492, 493, 497, 498, 530, 531, 513, 451,
1689 452, 507, 370, 370, 438, 533, 511, 370, 542, 504,
1690 370, 536, 516, 524, 532, 534, 535, 544, 265, 558,
1691 560, 265, 265, 265, 543, 537, 516, 572, 582, 548,
1692 508, 554, 552, 555, 556, 553, 567, 569, 570, 571,
1693 579, 583, 584, 481, 587, 483, 588, 590, 486, 593,
1694 594, 213, 214, 215, 490, 491, 338, 127, 557, 337,
1695 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1696 295, 296, 297, 298, 540, 139, 336, 142, 328, 42,
1697 565, 126, 514, 515, -199, 518, 519, 94, 528, 457,
1698 0, 523, 0, 0, 0, 0, 0, 0, 508, 0,
1699 0, 529, -66, 1, 2, 0, 3, 4, 5, 0,
1700 0, 0, 0, 0, 6, 7, 0, 0, 0, 0,
1701 0, 0, 545, 0, 0, 0, 0, 358, 359, 0,
1702 549, 61, 62, 360, 0, 8, 0, 0, 9, 0,
1703 0, 0, 10, 1, 2, 0, 3, 4, 5, 361,
1704 362, 363, 0, 0, 0, 0, 0, 0, 0, 0,
1705 0, 0, 0, 0, 364, 365, 573, 0, 0, 0,
1706 0, 577, 0, 0, 0, 0, 0, 0, 0, 0,
1707 0, 366, 0, 0, 0, 0, 0, 0, 585, 586,
1708 0, 0, 0, 589, 0, 0, 591, 174, 175, 176,
1709 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1710 187, 188, 245, 246, 0, 0, 0, 0, 0, 0,
1711 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1712 0, 0, 0, 0, 0, 0, 0, 0, 0, 247,
1713 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1714 205, 206, 0, 248, 0, 249, 250, 251, 0, 0,
1715 0, 358, 359, 0, 0, 61, 62, 360, 0, 0,
1716 0, 0, 108, 0, 109, 0, 0, 1, 2, 367,
1717 3, 4, 5, 361, 362, 363, 0, 0, 0, 0,
1718 61, 62, 0, 0, 0, 0, 0, 0, 364, 365,
1719 0, 0, 1, 2, 0, 3, 4, 5, 242, 0,
1720 0, 0, 0, 0, 0, 366, 0, 0, 0, 0,
1721 0, 0, 0, 243, 244, 0, 0, 0, 0, 0,
1722 0, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1723 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1724 0, 0, 0, 0, 0, 0, 174, 175, 176, 177,
1725 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1726 188, 245, 246, 247, 195, 196, 197, 198, 199, 200,
1727 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1728 250, 251, 0, 0, 0, 0, 0, 0, 247, 195,
1729 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
1730 206, 0, 248, 367, 249, 250, 251, 0, 0, 0,
1731 0, 358, 359, 0, 0, 0, 0, 360, 0, 0,
1732 0, 108, 0, 109, 0, 252, 0, 0, 253, 0,
1733 254, 0, 255, 361, 362, 363, 0, 0, 0, 0,
1734 0, 0, 0, 0, 0, 0, 0, 0, 364, 365,
1735 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1736 0, 0, 0, 61, 62, 366, 104, 64, 65, 66,
1737 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1738 5, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1739 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1740 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1741 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1742 5, 0, 0, 247, 195, 196, 197, 198, 199, 200,
1743 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1744 250, 251, 0, 61, 62, 71, 104, 150, 151, 152,
1745 153, 154, 155, 70, 0, 1, 2, 0, 3, 4,
1746 5, 61, 62, 367, 104, 150, 151, 152, 153, 154,
1747 155, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1748 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1749 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1750 5, 0, 0, 71, 0, 72, 0, 0, 73, 0,
1751 0, 74, 0, 75, 105, 131, 0, 0, 0, 0,
1752 0, 0, 0, 61, 62, 71, 145, 64, 65, 66,
1753 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1754 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1755 0, 74, 0, 75, 138, 0, 0, 0, 0, 0,
1756 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1757 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1758 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1759 0, 74, 0, 75, 349, 327, 0, 0, 0, 0,
1760 0, 0, 0, 72, 0, 71, 73, 0, 0, 74,
1761 0, 75, 413, 0, 0, 0, 0, 0, 0, 0,
1762 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1763 0, 74, 0, 75, 0, 61, 62, 146, 104, 150,
1764 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1765 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1766 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1767 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1768 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1769 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1770 0, 0, 0, 0, 0, 72, 0, 425, 73, 0,
1771 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1772 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1773 3, 4, 5, 61, 62, 0, 63, 64, 65, 66,
1774 67, 68, 69, 70, 0, 1, 2, 510, 3, 4,
1775 5, 0, 0, 0, 0, 61, 62, 71, 104, 150,
1776 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1777 3, 4, 5, 0, 0, 71, 0, 72, 0, 0,
1778 73, 0, 344, 74, 0, 75, 61, 62, 0, 145,
1779 64, 65, 66, 67, 68, 69, 70, 71, 1, 2,
1780 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1781 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1782 73, 0, 0, 74, 0, 75, 61, 62, 71, 104,
1783 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1784 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1785 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1786 73, 0, 0, 74, 0, 75, 0, 0, 71, 0,
1787 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1788 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
1789 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1790 73, 0, 0, 74, 0, 75, 61, 62, 0, 264,
1791 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1792 0, 3, 4, 5, 0, 0, 0, 0, 72, 0,
1793 0, 73, 0, 0, 74, 0, 75, 61, 62, 0,
1794 104, 150, 151, 152, 153, 154, 155, 70, 71, 1,
1795 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
1796 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1797 0, 73, 0, 0, 74, 0, 75, 0, 0, 71,
1798 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1799 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1800 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1801 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1802 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1803 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1804 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1805 0, 73, 0, 0, 74, 0, 75, 165, 0, 0,
1806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1807 0, 0, 0, 0, 0, 0, 166, 167, 0, 72,
1808 0, 0, 73, 0, 0, 74, 0, 347, 168, 169,
1809 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
1810 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1811 190, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1812 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1813 0, 191, 192, 193, 0, 0, 194, 195, 196, 197,
1814 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1815 208, 209, 210, 211, 212
1818 static const short yycheck[] = { 0,
1819 26, 170, 158, 230, 124, 4, 11, 11, 148, 193,
1820 301, 28, 171, 0, 146, 16, 334, 335, 158, 426,
1821 34, 253, 254, 38, 208, 209, 210, 211, 212, 16,
1822 52, 215, 21, 11, 11, 148, 562, 150, 151, 53,
1823 29, 0, 147, 34, 66, 3, 4, 5, 6, 75,
1824 576, 147, 146, 158, 20, 147, 117, 23, 217, 18,
1825 19, 20, 158, 22, 23, 24, 158, 147, 26, 27,
1826 147, 30, 31, 99, 154, 53, 53, 103, 39, 40,
1827 11, 158, 143, 109, 45, 147, 17, 147, 114, 90,
1828 51, 46, 51, 48, 156, 54, 156, 19, 124, 58,
1829 22, 148, 24, 150, 511, 147, 424, 32, 33, 156,
1830 136, 137, 154, 147, 140, 347, 57, 151, 144, 134,
1831 135, 136, 18, 146, 139, 265, 19, 267, 268, 22,
1832 270, 24, 316, 146, 35, 367, 37, 148, 545, 150,
1833 157, 152, 168, 134, 135, 136, 113, 114, 139, 154,
1834 154, 271, 152, 148, 148, 150, 150, 151, 157, 154,
1835 148, 452, 150, 303, 146, 191, 192, 193, 194, 158,
1836 577, 311, 312, 22, 161, 60, 61, 62, 63, 64,
1837 65, 207, 208, 209, 210, 211, 212, 213, 214, 215,
1838 481, 42, 483, 44, 314, 117, 118, 223, 147, 81,
1839 82, 385, 151, 387, 388, 389, 21, 233, 22, 42,
1840 43, 44, 134, 135, 47, 137, 138, 147, 140, 141,
1841 142, 151, 22, 42, 43, 44, 45, 46, 47, 48,
1842 22, 50, 143, 144, 145, 375, 376, 377, 529, 134,
1843 135, 136, 150, 383, 139, 271, 473, 117, 118, 3,
1844 4, 5, 6, 393, 394, 4, 282, 4, 414, 147,
1845 148, 37, 150, 153, 134, 135, 153, 137, 138, 4,
1846 140, 141, 142, 299, 414, 110, 111, 22, 339, 340,
1847 341, 342, 343, 147, 148, 147, 150, 156, 314, 315,
1848 316, 352, 353, 354, 151, 151, 150, 437, 9, 439,
1849 484, 9, 442, 487, 488, 489, 9, 9, 448, 449,
1850 9, 9, 55, 267, 268, 11, 270, 7, 8, 156,
1851 547, 347, 150, 550, 143, 144, 145, 150, 150, 19,
1852 20, 357, 22, 23, 24, 22, 476, 477, 150, 479,
1853 480, 150, 150, 404, 405, 485, 150, 150, 147, 303,
1854 411, 147, 150, 147, 147, 495, 147, 311, 312, 385,
1855 386, 387, 388, 389, 147, 147, 392, 38, 38, 150,
1856 150, 59, 147, 147, 152, 544, 516, 403, 147, 147,
1857 147, 147, 147, 147, 524, 147, 156, 147, 147, 38,
1858 22, 4, 147, 151, 563, 22, 17, 458, 459, 460,
1859 461, 17, 150, 147, 465, 466, 90, 91, 92, 93,
1860 94, 95, 96, 97, 98, 99, 147, 4, 147, 147,
1861 560, 375, 376, 377, 147, 565, 147, 453, 147, 383,
1862 26, 27, 150, 147, 147, 147, 497, 498, 147, 393,
1863 394, 467, 582, 583, 53, 151, 472, 587, 22, 156,
1864 590, 151, 478, 147, 147, 147, 147, 152, 484, 53,
1865 17, 487, 488, 489, 147, 151, 492, 4, 17, 154,
1866 471, 532, 151, 534, 535, 151, 154, 151, 151, 151,
1867 147, 17, 147, 437, 17, 439, 71, 17, 442, 0,
1868 0, 127, 127, 127, 448, 449, 246, 90, 539, 245,
1869 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1870 106, 107, 108, 109, 512, 103, 233, 109, 223, 16,
1871 546, 87, 476, 477, 0, 479, 480, 54, 492, 406,
1872 -1, 485, -1, -1, -1, -1, -1, -1, 539, -1,
1873 -1, 495, 18, 19, 20, -1, 22, 23, 24, -1,
1874 -1, -1, -1, -1, 30, 31, -1, -1, -1, -1,
1875 -1, -1, 516, -1, -1, -1, -1, 3, 4, -1,
1876 524, 7, 8, 9, -1, 51, -1, -1, 54, -1,
1877 -1, -1, 58, 19, 20, -1, 22, 23, 24, 25,
1878 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
1879 -1, -1, -1, -1, 40, 41, 560, -1, -1, -1,
1880 -1, 565, -1, -1, -1, -1, -1, -1, -1, -1,
1881 -1, 57, -1, -1, -1, -1, -1, -1, 582, 583,
1882 -1, -1, -1, 587, -1, -1, 590, 73, 74, 75,
1883 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1884 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
1885 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1886 -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
1887 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1888 126, 127, -1, 129, -1, 131, 132, 133, -1, -1,
1889 -1, 3, 4, -1, -1, 7, 8, 9, -1, -1,
1890 -1, -1, 148, -1, 150, -1, -1, 19, 20, 155,
1891 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
1892 7, 8, -1, -1, -1, -1, -1, -1, 40, 41,
1893 -1, -1, 19, 20, -1, 22, 23, 24, 25, -1,
1894 -1, -1, -1, -1, -1, 57, -1, -1, -1, -1,
1895 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
1896 -1, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1897 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1898 -1, -1, -1, -1, -1, -1, 73, 74, 75, 76,
1899 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1900 87, 88, 89, 115, 116, 117, 118, 119, 120, 121,
1901 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1902 132, 133, -1, -1, -1, -1, -1, -1, 115, 116,
1903 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1904 127, -1, 129, 155, 131, 132, 133, -1, -1, -1,
1905 -1, 3, 4, -1, -1, -1, -1, 9, -1, -1,
1906 -1, 148, -1, 150, -1, 152, -1, -1, 155, -1,
1907 157, -1, 159, 25, 26, 27, -1, -1, -1, -1,
1908 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
1909 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1910 -1, -1, -1, 7, 8, 57, 10, 11, 12, 13,
1911 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1912 24, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1913 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1914 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1915 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1916 24, -1, -1, 115, 116, 117, 118, 119, 120, 121,
1917 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1918 132, 133, -1, 7, 8, 49, 10, 11, 12, 13,
1919 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1920 24, 7, 8, 155, 10, 11, 12, 13, 14, 15,
1921 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1922 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1923 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1924 24, -1, -1, 49, -1, 149, -1, -1, 152, -1,
1925 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1926 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1927 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1928 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1929 -1, 155, -1, 157, 158, -1, -1, -1, -1, -1,
1930 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1931 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1932 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1933 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1934 -1, -1, -1, 149, -1, 49, 152, -1, -1, 155,
1935 -1, 157, 158, -1, -1, -1, -1, -1, -1, -1,
1936 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1937 -1, 155, -1, 157, -1, 7, 8, 121, 10, 11,
1938 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1939 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1940 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1941 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1942 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1943 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1944 -1, -1, -1, -1, -1, 149, -1, 39, 152, -1,
1945 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1946 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1947 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
1948 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
1949 24, -1, -1, -1, -1, 7, 8, 49, 10, 11,
1950 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1951 22, 23, 24, -1, -1, 49, -1, 149, -1, -1,
1952 152, -1, 154, 155, -1, 157, 7, 8, -1, 10,
1953 11, 12, 13, 14, 15, 16, 17, 49, 19, 20,
1954 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1955 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1956 152, -1, -1, 155, -1, 157, 7, 8, 49, 10,
1957 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1958 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1959 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1960 152, -1, -1, 155, -1, 157, -1, -1, 49, -1,
1961 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1962 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
1963 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1964 152, -1, -1, 155, -1, 157, 7, 8, -1, 10,
1965 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1966 -1, 22, 23, 24, -1, -1, -1, -1, 149, -1,
1967 -1, 152, -1, -1, 155, -1, 157, 7, 8, -1,
1968 10, 11, 12, 13, 14, 15, 16, 17, 49, 19,
1969 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
1970 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1971 -1, 152, -1, -1, 155, -1, 157, -1, -1, 49,
1972 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1973 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1974 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1975 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1976 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1977 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1978 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1979 -1, 152, -1, -1, 155, -1, 157, 36, -1, -1,
1980 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1981 -1, -1, -1, -1, -1, -1, 55, 56, -1, 149,
1982 -1, -1, 152, -1, -1, 155, -1, 157, 67, 68,
1983 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
1984 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1985 89, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1986 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1987 -1, 110, 111, 112, -1, -1, 115, 116, 117, 118,
1988 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
1989 129, 130, 131, 132, 133
1991 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1992 #line 3 "/usr/share/bison.simple"
1993 /* This file comes from bison-1.28. */
1995 /* Skeleton output parser for bison,
1996 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1998 This program is free software; you can redistribute it and/or modify
1999 it under the terms of the GNU General Public License as published by
2000 the Free Software Foundation; either version 2, or (at your option)
2003 This program is distributed in the hope that it will be useful,
2004 but WITHOUT ANY WARRANTY; without even the implied warranty of
2005 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2006 GNU General Public License for more details.
2008 You should have received a copy of the GNU General Public License
2009 along with this program; if not, write to the Free Software
2010 Foundation, Inc., 59 Temple Place - Suite 330,
2011 Boston, MA 02111-1307, USA. */
2013 /* As a special exception, when this file is copied by Bison into a
2014 Bison output file, you may use that output file without restriction.
2015 This special exception was added by the Free Software Foundation
2016 in version 1.24 of Bison. */
2018 /* This is the parser code that is written into each bison parser
2019 when the %semantic_parser declaration is not specified in the grammar.
2020 It was written by Richard Stallman by simplifying the hairy parser
2021 used when %semantic_parser is specified. */
2023 #ifndef YYSTACK_USE_ALLOCA
2025 #define YYSTACK_USE_ALLOCA
2026 #else /* alloca not defined */
2028 #define YYSTACK_USE_ALLOCA
2029 #define alloca __builtin_alloca
2030 #else /* not GNU C. */
2031 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2032 #define YYSTACK_USE_ALLOCA
2034 #else /* not sparc */
2035 /* We think this test detects Watcom and Microsoft C. */
2036 /* This used to test MSDOS, but that is a bad idea
2037 since that symbol is in the user namespace. */
2038 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2039 #if 0 /* No need for malloc.h, which pollutes the namespace;
2040 instead, just don't use alloca. */
2043 #else /* not MSDOS, or __TURBOC__ */
2045 /* I don't know what this was needed for, but it pollutes the namespace.
2046 So I turned it off. rms, 2 May 1997. */
2047 /* #include <malloc.h> */
2049 #define YYSTACK_USE_ALLOCA
2050 #else /* not MSDOS, or __TURBOC__, or _AIX */
2052 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2053 and on HPUX 10. Eventually we can turn this on. */
2054 #define YYSTACK_USE_ALLOCA
2055 #define alloca __builtin_alloca
2058 #endif /* not _AIX */
2059 #endif /* not MSDOS, or __TURBOC__ */
2060 #endif /* not sparc */
2061 #endif /* not GNU C */
2062 #endif /* alloca not defined */
2063 #endif /* YYSTACK_USE_ALLOCA not defined */
2065 #ifdef YYSTACK_USE_ALLOCA
2066 #define YYSTACK_ALLOC alloca
2068 #define YYSTACK_ALLOC malloc
2071 /* Note: there must be only one dollar sign in this file.
2072 It is replaced by the list of actions, each action
2073 as one case of the switch. */
2075 #define yyerrok (yyerrstatus = 0)
2076 #define yyclearin (yychar = YYEMPTY)
2079 #define YYACCEPT goto yyacceptlab
2080 #define YYABORT goto yyabortlab
2081 #define YYERROR goto yyerrlab1
2082 /* Like YYERROR except do call yyerror.
2083 This remains here temporarily to ease the
2084 transition to the new meaning of YYERROR, for GCC.
2085 Once GCC version 2 has supplanted version 1, this can go. */
2086 #define YYFAIL goto yyerrlab
2087 #define YYRECOVERING() (!!yyerrstatus)
2088 #define YYBACKUP(token, value) \
2090 if (yychar == YYEMPTY && yylen == 1) \
2091 { yychar = (token), yylval = (value); \
2092 yychar1 = YYTRANSLATE (yychar); \
2097 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2101 #define YYERRCODE 256
2104 #define YYLEX yylex()
2110 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2112 #define YYLEX yylex(&yylval, &yylloc)
2114 #else /* not YYLSP_NEEDED */
2116 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2118 #define YYLEX yylex(&yylval)
2120 #endif /* not YYLSP_NEEDED */
2123 /* If nonreentrant, generate the variables here */
2127 int yychar; /* the lookahead symbol */
2128 YYSTYPE yylval; /* the semantic value of the */
2129 /* lookahead symbol */
2132 YYLTYPE yylloc; /* location data for the lookahead */
2136 int yynerrs; /* number of parse errors so far */
2137 #endif /* not YYPURE */
2140 int yydebug; /* nonzero means print parse trace */
2141 /* Since this is uninitialized, it does not stop multiple parsers
2145 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2148 #define YYINITDEPTH 200
2151 /* YYMAXDEPTH is the maximum size the stacks can grow to
2152 (effective only if the built-in stack extension method is used). */
2159 #define YYMAXDEPTH 10000
2162 /* Define __yy_memcpy. Note that the size argument
2163 should be passed with type unsigned int, because that is what the non-GCC
2164 definitions require. With GCC, __builtin_memcpy takes an arg
2165 of type size_t, but it can handle unsigned int. */
2167 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2168 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2169 #else /* not GNU C or C++ */
2172 /* This is the most reliable way to avoid incompatibilities
2173 in available built-in functions on various systems. */
2175 __yy_memcpy (to, from, count)
2180 register char *f = from;
2181 register char *t = to;
2182 register int i = count;
2188 #else /* __cplusplus */
2190 /* This is the most reliable way to avoid incompatibilities
2191 in available built-in functions on various systems. */
2193 __yy_memcpy (char *to, char *from, unsigned int count)
2195 register char *t = to;
2196 register char *f = from;
2197 register int i = count;
2206 #line 217 "/usr/share/bison.simple"
2208 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2209 into yyparse. The argument should have type void *.
2210 It should actually point to an object.
2211 Grammar actions can access the variable by casting it
2212 to the proper pointer type. */
2214 #ifdef YYPARSE_PARAM
2216 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2217 #define YYPARSE_PARAM_DECL
2218 #else /* not __cplusplus */
2219 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2220 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2221 #endif /* not __cplusplus */
2222 #else /* not YYPARSE_PARAM */
2223 #define YYPARSE_PARAM_ARG
2224 #define YYPARSE_PARAM_DECL
2225 #endif /* not YYPARSE_PARAM */
2227 /* Prevent warning if -Wstrict-prototypes. */
2229 #ifdef YYPARSE_PARAM
2230 int yyparse (void *);
2237 yyparse(YYPARSE_PARAM_ARG)
2240 register int yystate;
2242 register short *yyssp;
2243 register YYSTYPE *yyvsp;
2244 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2245 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2247 short yyssa[YYINITDEPTH]; /* the state stack */
2248 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2250 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2251 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2254 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2255 YYLTYPE *yyls = yylsa;
2258 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2260 #define YYPOPSTACK (yyvsp--, yyssp--)
2263 int yystacksize = YYINITDEPTH;
2264 int yyfree_stacks = 0;
2275 YYSTYPE yyval; /* the variable used to return */
2276 /* semantic values from the action */
2283 fprintf(stderr, "Starting parse\n");
2289 yychar = YYEMPTY; /* Cause a token to be read. */
2291 /* Initialize stack pointers.
2292 Waste one element of value and location stack
2293 so that they stay on the same level as the state stack.
2294 The wasted elements are never initialized. */
2302 /* Push a new state, which is found in yystate . */
2303 /* In all cases, when you get here, the value and location stacks
2304 have just been pushed. so pushing a state here evens the stacks. */
2309 if (yyssp >= yyss + yystacksize - 1)
2311 /* Give user a chance to reallocate the stack */
2312 /* Use copies of these so that the &'s don't force the real ones into memory. */
2313 YYSTYPE *yyvs1 = yyvs;
2314 short *yyss1 = yyss;
2316 YYLTYPE *yyls1 = yyls;
2319 /* Get the current used size of the three stacks, in elements. */
2320 int size = yyssp - yyss + 1;
2323 /* Each stack pointer address is followed by the size of
2324 the data in use in that stack, in bytes. */
2326 /* This used to be a conditional around just the two extra args,
2327 but that might be undefined if yyoverflow is a macro. */
2328 yyoverflow("parser stack overflow",
2329 &yyss1, size * sizeof (*yyssp),
2330 &yyvs1, size * sizeof (*yyvsp),
2331 &yyls1, size * sizeof (*yylsp),
2334 yyoverflow("parser stack overflow",
2335 &yyss1, size * sizeof (*yyssp),
2336 &yyvs1, size * sizeof (*yyvsp),
2340 yyss = yyss1; yyvs = yyvs1;
2344 #else /* no yyoverflow */
2345 /* Extend the stack our own way. */
2346 if (yystacksize >= YYMAXDEPTH)
2348 yyerror("parser stack overflow");
2360 if (yystacksize > YYMAXDEPTH)
2361 yystacksize = YYMAXDEPTH;
2362 #ifndef YYSTACK_USE_ALLOCA
2365 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2366 __yy_memcpy ((char *)yyss, (char *)yyss1,
2367 size * (unsigned int) sizeof (*yyssp));
2368 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2369 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2370 size * (unsigned int) sizeof (*yyvsp));
2372 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2373 __yy_memcpy ((char *)yyls, (char *)yyls1,
2374 size * (unsigned int) sizeof (*yylsp));
2376 #endif /* no yyoverflow */
2378 yyssp = yyss + size - 1;
2379 yyvsp = yyvs + size - 1;
2381 yylsp = yyls + size - 1;
2386 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2389 if (yyssp >= yyss + yystacksize - 1)
2395 fprintf(stderr, "Entering state %d\n", yystate);
2401 /* Do appropriate processing given the current state. */
2402 /* Read a lookahead token if we need one and don't already have one. */
2405 /* First try to decide what to do without reference to lookahead token. */
2407 yyn = yypact[yystate];
2411 /* Not known => get a lookahead token if don't already have one. */
2413 /* yychar is either YYEMPTY or YYEOF
2414 or a valid token in external form. */
2416 if (yychar == YYEMPTY)
2420 fprintf(stderr, "Reading a token: ");
2425 /* Convert token to internal form (in yychar1) for indexing tables with */
2427 if (yychar <= 0) /* This means end of input. */
2430 yychar = YYEOF; /* Don't call YYLEX any more */
2434 fprintf(stderr, "Now at end of input.\n");
2439 yychar1 = YYTRANSLATE(yychar);
2444 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2445 /* Give the individual parser a way to print the precise meaning
2446 of a token, for further debugging info. */
2448 YYPRINT (stderr, yychar, yylval);
2450 fprintf (stderr, ")\n");
2456 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2461 /* yyn is what to do for this token type in this state.
2462 Negative => reduce, -yyn is rule number.
2463 Positive => shift, yyn is new state.
2464 New state is final state => don't bother to shift,
2465 just return success.
2466 0, or most negative number => error. */
2481 /* Shift the lookahead token. */
2485 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2488 /* Discard the token being shifted unless it is eof. */
2489 if (yychar != YYEOF)
2497 /* count tokens shifted since error; after three, turn off error status. */
2498 if (yyerrstatus) yyerrstatus--;
2503 /* Do the default action for the current state. */
2506 yyn = yydefact[yystate];
2510 /* Do a reduction. yyn is the number of a rule to reduce with. */
2514 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2521 fprintf (stderr, "Reducing via rule %d (line %d), ",
2524 /* Print the symbols being reduced, and their result. */
2525 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2526 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2527 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2535 #line 1128 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2536 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2539 #line 1128 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2540 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2543 #line 1129 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2544 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2547 #line 1129 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2548 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2551 #line 1130 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2552 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2555 #line 1130 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2556 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2559 #line 1131 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2560 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2563 #line 1131 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2564 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2567 #line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2568 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2571 #line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2572 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2575 #line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2576 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2579 #line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2580 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2583 #line 1137 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2584 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2587 #line 1137 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2588 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2591 #line 1138 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2592 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2595 #line 1138 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2596 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2599 #line 1139 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2600 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2603 #line 1139 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2604 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2607 #line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2608 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2611 #line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2612 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2615 #line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2616 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2619 #line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2620 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2623 #line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2624 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2627 #line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2628 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2631 #line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2632 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2635 #line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2636 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2639 #line 1153 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2640 { yyval.StrVal = 0; ;
2643 #line 1157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2645 yyval.StrVal = yyvsp[-1].StrVal;
2650 #line 1161 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2657 #line 1169 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2664 #line 1174 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2666 yyval.StrVal = yyvsp[-1].StrVal;
2671 #line 1180 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2672 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2675 #line 1181 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2676 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2679 #line 1182 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2680 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2683 #line 1183 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2684 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2687 #line 1184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2688 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2691 #line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2692 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2695 #line 1189 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2696 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2699 #line 1190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2700 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2703 #line 1194 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2704 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2707 #line 1195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2708 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2711 #line 1196 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2712 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2715 #line 1197 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2716 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2719 #line 1201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2720 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2723 #line 1202 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2724 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2727 #line 1203 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2728 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2731 #line 1207 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2732 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2735 #line 1208 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2736 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2739 #line 1209 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2740 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2743 #line 1210 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2744 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2747 #line 1211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2748 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2751 #line 1215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2752 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2755 #line 1216 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2756 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2759 #line 1217 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2760 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2763 #line 1220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2764 { yyval.UIntVal = CallingConv::C; ;
2767 #line 1221 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2768 { yyval.UIntVal = CallingConv::C; ;
2771 #line 1222 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2772 { yyval.UIntVal = CallingConv::Fast; ;
2775 #line 1223 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2776 { yyval.UIntVal = CallingConv::Cold; ;
2779 #line 1224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2780 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2783 #line 1225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2784 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2787 #line 1226 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2789 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2790 GEN_ERROR("Calling conv too large");
2791 yyval.UIntVal = yyvsp[0].UInt64Val;
2796 #line 1233 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2797 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2800 #line 1234 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2801 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2804 #line 1235 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2805 { yyval.ParamAttrs = ParamAttr::SExt; ;
2808 #line 1236 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2809 { yyval.ParamAttrs = ParamAttr::SExt; ;
2812 #line 1237 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2813 { yyval.ParamAttrs = ParamAttr::InReg; ;
2816 #line 1238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2817 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2820 #line 1239 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2821 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2824 #line 1240 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2825 { yyval.ParamAttrs = ParamAttr::ByVal; ;
2828 #line 1241 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2829 { yyval.ParamAttrs = ParamAttr::Nest; ;
2832 #line 1244 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2833 { yyval.ParamAttrs = ParamAttr::None; ;
2836 #line 1245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2838 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2842 #line 1250 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2843 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2846 #line 1251 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2847 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2850 #line 1252 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2851 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2854 #line 1253 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2855 { yyval.ParamAttrs = ParamAttr::SExt; ;
2858 #line 1256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2859 { yyval.ParamAttrs = ParamAttr::None; ;
2862 #line 1257 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2864 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2868 #line 1264 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2869 { yyval.UIntVal = 0; ;
2872 #line 1265 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2874 yyval.UIntVal = yyvsp[0].UInt64Val;
2875 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2876 GEN_ERROR("Alignment must be a power of two");
2881 #line 1271 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2882 { yyval.UIntVal = 0; ;
2885 #line 1272 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2887 yyval.UIntVal = yyvsp[0].UInt64Val;
2888 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2889 GEN_ERROR("Alignment must be a power of two");
2894 #line 1280 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2896 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2897 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2898 GEN_ERROR("Invalid character in section name");
2899 yyval.StrVal = yyvsp[0].StrVal;
2904 #line 1288 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2905 { yyval.StrVal = 0; ;
2908 #line 1289 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2909 { yyval.StrVal = yyvsp[0].StrVal; ;
2912 #line 1294 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2916 #line 1295 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2920 #line 1296 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2922 CurGV->setSection(*yyvsp[0].StrVal);
2923 delete yyvsp[0].StrVal;
2928 #line 1301 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2930 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2931 GEN_ERROR("Alignment must be a power of two");
2932 CurGV->setAlignment(yyvsp[0].UInt64Val);
2937 #line 1317 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2939 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2944 #line 1321 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2946 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2951 #line 1325 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2953 if (*yyvsp[-1].TypeVal == Type::LabelTy)
2954 GEN_ERROR("Cannot form a pointer to a basic block");
2955 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2956 delete yyvsp[-1].TypeVal;
2961 #line 1332 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2962 { // Named types are also simple types...
2963 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
2965 yyval.TypeVal = new PATypeHolder(tmp);
2969 #line 1337 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2970 { // Type UpReference
2971 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
2972 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2973 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2974 yyval.TypeVal = new PATypeHolder(OT);
2975 UR_OUT("New Upreference!\n");
2980 #line 1345 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2982 std::vector<const Type*> Params;
2983 ParamAttrsVector Attrs;
2984 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
2985 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
2989 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
2990 for (; I != E; ++I, ++index) {
2991 const Type *Ty = I->Ty->get();
2992 Params.push_back(Ty);
2993 if (Ty != Type::VoidTy)
2994 if (I->Attrs != ParamAttr::None) {
2995 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
2999 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3000 if (isVarArg) Params.pop_back();
3002 ParamAttrsList *ActualAttrs = 0;
3004 ActualAttrs = ParamAttrsList::get(Attrs);
3005 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3006 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3007 delete yyvsp[-4].TypeVal; // Delete the return type handle
3008 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3013 #line 1375 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3015 std::vector<const Type*> Params;
3016 ParamAttrsVector Attrs;
3017 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3018 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3021 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3023 for ( ; I != E; ++I, ++index) {
3024 const Type* Ty = I->Ty->get();
3025 Params.push_back(Ty);
3026 if (Ty != Type::VoidTy)
3027 if (I->Attrs != ParamAttr::None) {
3028 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3032 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3033 if (isVarArg) Params.pop_back();
3035 ParamAttrsList *ActualAttrs = 0;
3037 ActualAttrs = ParamAttrsList::get(Attrs);
3039 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3040 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3041 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3046 #line 1406 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3047 { // Sized array type?
3048 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3049 delete yyvsp[-1].TypeVal;
3054 #line 1411 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3056 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3057 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3058 GEN_ERROR("Unsigned result not equal to signed result");
3059 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3060 GEN_ERROR("Element type of a VectorType must be primitive");
3061 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3062 GEN_ERROR("Vector length should be a power of 2");
3063 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3064 delete yyvsp[-1].TypeVal;
3069 #line 1423 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3070 { // Structure type?
3071 std::vector<const Type*> Elements;
3072 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3073 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3074 Elements.push_back(*I);
3076 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3077 delete yyvsp[-1].TypeList;
3082 #line 1433 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3083 { // Empty structure type?
3084 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3089 #line 1437 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3091 std::vector<const Type*> Elements;
3092 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3093 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3094 Elements.push_back(*I);
3096 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3097 delete yyvsp[-2].TypeList;
3102 #line 1447 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3103 { // Empty structure type?
3104 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3109 #line 1454 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3111 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3112 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3116 #line 1461 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3118 if (!UpRefs.empty())
3119 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3120 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3121 GEN_ERROR("LLVM functions cannot return aggregate types");
3122 yyval.TypeVal = yyvsp[0].TypeVal;
3126 #line 1468 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3128 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3132 #line 1473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3134 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3135 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3140 #line 1478 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3142 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3147 #line 1486 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3149 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3150 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3151 TWA.Ty = new PATypeHolder(Type::VoidTy);
3152 yyval.TypeWithAttrsList->push_back(TWA);
3157 #line 1493 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3159 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3160 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3161 TWA.Ty = new PATypeHolder(Type::VoidTy);
3162 yyval.TypeWithAttrsList->push_back(TWA);
3167 #line 1500 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3169 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3174 #line 1508 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3176 yyval.TypeList = new std::list<PATypeHolder>();
3177 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3178 delete yyvsp[0].TypeVal;
3183 #line 1514 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3185 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3186 delete yyvsp[0].TypeVal;
3191 #line 1526 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3192 { // Nonempty unsized arr
3193 if (!UpRefs.empty())
3194 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3195 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3197 GEN_ERROR("Cannot make array constant with type: '" +
3198 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3199 const Type *ETy = ATy->getElementType();
3200 int NumElements = ATy->getNumElements();
3202 // Verify that we have the correct size...
3203 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3204 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3205 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3206 itostr(NumElements) + "");
3208 // Verify all elements are correct type!
3209 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3210 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3211 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3212 ETy->getDescription() +"' as required!\nIt is of type '"+
3213 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3216 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3217 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3222 #line 1554 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3224 if (!UpRefs.empty())
3225 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3226 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3228 GEN_ERROR("Cannot make array constant with type: '" +
3229 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3231 int NumElements = ATy->getNumElements();
3232 if (NumElements != -1 && NumElements != 0)
3233 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3234 " arguments, but has size of " + itostr(NumElements) +"");
3235 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3236 delete yyvsp[-2].TypeVal;
3241 #line 1570 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3243 if (!UpRefs.empty())
3244 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3245 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3247 GEN_ERROR("Cannot make array constant with type: '" +
3248 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3250 int NumElements = ATy->getNumElements();
3251 const Type *ETy = ATy->getElementType();
3252 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3253 GEN_ERROR("Can't build string constant of size " +
3254 itostr((int)(yyvsp[0].StrVal->length())) +
3255 " when array has size " + itostr(NumElements) + "");
3256 std::vector<Constant*> Vals;
3257 if (ETy == Type::Int8Ty) {
3258 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3259 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3261 delete yyvsp[0].StrVal;
3262 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3264 delete yyvsp[0].StrVal;
3265 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3266 delete yyvsp[-2].TypeVal;
3271 #line 1597 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3272 { // Nonempty unsized arr
3273 if (!UpRefs.empty())
3274 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3275 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3277 GEN_ERROR("Cannot make packed constant with type: '" +
3278 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3279 const Type *ETy = PTy->getElementType();
3280 int NumElements = PTy->getNumElements();
3282 // Verify that we have the correct size...
3283 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3284 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3285 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3286 itostr(NumElements) + "");
3288 // Verify all elements are correct type!
3289 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3290 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3291 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3292 ETy->getDescription() +"' as required!\nIt is of type '"+
3293 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3296 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3297 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3302 #line 1625 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3304 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3306 GEN_ERROR("Cannot make struct constant with type: '" +
3307 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3309 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3310 GEN_ERROR("Illegal number of initializers for structure type");
3312 // Check to ensure that constants are compatible with the type initializer!
3313 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3314 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3315 GEN_ERROR("Expected type '" +
3316 STy->getElementType(i)->getDescription() +
3317 "' for element #" + utostr(i) +
3318 " of structure initializer");
3320 // Check to ensure that Type is not packed
3321 if (STy->isPacked())
3322 GEN_ERROR("Unpacked Initializer to vector type '" +
3323 STy->getDescription() + "'");
3325 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3326 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3331 #line 1651 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3333 if (!UpRefs.empty())
3334 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3335 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3337 GEN_ERROR("Cannot make struct constant with type: '" +
3338 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3340 if (STy->getNumContainedTypes() != 0)
3341 GEN_ERROR("Illegal number of initializers for structure type");
3343 // Check to ensure that Type is not packed
3344 if (STy->isPacked())
3345 GEN_ERROR("Unpacked Initializer to vector type '" +
3346 STy->getDescription() + "'");
3348 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3349 delete yyvsp[-2].TypeVal;
3354 #line 1671 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3356 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3358 GEN_ERROR("Cannot make struct constant with type: '" +
3359 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3361 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3362 GEN_ERROR("Illegal number of initializers for structure type");
3364 // Check to ensure that constants are compatible with the type initializer!
3365 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3366 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3367 GEN_ERROR("Expected type '" +
3368 STy->getElementType(i)->getDescription() +
3369 "' for element #" + utostr(i) +
3370 " of structure initializer");
3372 // Check to ensure that Type is packed
3373 if (!STy->isPacked())
3374 GEN_ERROR("Vector initializer to non-vector type '" +
3375 STy->getDescription() + "'");
3377 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3378 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3383 #line 1697 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3385 if (!UpRefs.empty())
3386 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3387 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3389 GEN_ERROR("Cannot make struct constant with type: '" +
3390 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3392 if (STy->getNumContainedTypes() != 0)
3393 GEN_ERROR("Illegal number of initializers for structure type");
3395 // Check to ensure that Type is packed
3396 if (!STy->isPacked())
3397 GEN_ERROR("Vector initializer to non-vector type '" +
3398 STy->getDescription() + "'");
3400 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3401 delete yyvsp[-4].TypeVal;
3406 #line 1717 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3408 if (!UpRefs.empty())
3409 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3410 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3412 GEN_ERROR("Cannot make null pointer constant with type: '" +
3413 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3415 yyval.ConstVal = ConstantPointerNull::get(PTy);
3416 delete yyvsp[-1].TypeVal;
3421 #line 1729 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3423 if (!UpRefs.empty())
3424 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3425 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3426 delete yyvsp[-1].TypeVal;
3431 #line 1736 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3433 if (!UpRefs.empty())
3434 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3435 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3437 GEN_ERROR("Global const reference must be a pointer type");
3439 // ConstExprs can exist in the body of a function, thus creating
3440 // GlobalValues whenever they refer to a variable. Because we are in
3441 // the context of a function, getExistingVal will search the functions
3442 // symbol table instead of the module symbol table for the global symbol,
3443 // which throws things all off. To get around this, we just tell
3444 // getExistingVal that we are at global scope here.
3446 Function *SavedCurFn = CurFun.CurrentFunction;
3447 CurFun.CurrentFunction = 0;
3449 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3452 CurFun.CurrentFunction = SavedCurFn;
3454 // If this is an initializer for a constant pointer, which is referencing a
3455 // (currently) undefined variable, create a stub now that shall be replaced
3456 // in the future with the right type of variable.
3459 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3460 const PointerType *PT = cast<PointerType>(Ty);
3462 // First check to see if the forward references value is already created!
3463 PerModuleInfo::GlobalRefsType::iterator I =
3464 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3466 if (I != CurModule.GlobalRefs.end()) {
3467 V = I->second; // Placeholder already exists, use it...
3468 yyvsp[0].ValIDVal.destroy();
3471 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3472 Name = yyvsp[0].ValIDVal.getName();
3473 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3474 GEN_ERROR("Invalid reference to global");
3476 // Create the forward referenced global.
3478 if (const FunctionType *FTy =
3479 dyn_cast<FunctionType>(PT->getElementType())) {
3480 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3481 CurModule.CurrentModule);
3483 GV = new GlobalVariable(PT->getElementType(), false,
3484 GlobalValue::ExternalWeakLinkage, 0,
3485 Name, CurModule.CurrentModule);
3488 // Keep track of the fact that we have a forward ref to recycle it
3489 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3494 yyval.ConstVal = cast<GlobalValue>(V);
3495 delete yyvsp[-1].TypeVal; // Free the type handle
3500 #line 1802 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3502 if (!UpRefs.empty())
3503 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3504 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3505 GEN_ERROR("Mismatched types for constant expression: " +
3506 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3507 yyval.ConstVal = yyvsp[0].ConstVal;
3508 delete yyvsp[-1].TypeVal;
3513 #line 1812 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3515 if (!UpRefs.empty())
3516 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3517 const Type *Ty = yyvsp[-1].TypeVal->get();
3518 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3519 GEN_ERROR("Cannot create a null initialized value of this type");
3520 yyval.ConstVal = Constant::getNullValue(Ty);
3521 delete yyvsp[-1].TypeVal;
3526 #line 1822 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3527 { // integral constants
3528 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3529 GEN_ERROR("Constant value doesn't fit in type");
3530 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3535 #line 1828 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3536 { // arbitrary precision integer constants
3537 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3538 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3539 GEN_ERROR("Constant value does not fit in type");
3541 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3542 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3543 delete yyvsp[0].APIntVal;
3548 #line 1838 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3549 { // integral constants
3550 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3551 GEN_ERROR("Constant value doesn't fit in type");
3552 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3557 #line 1844 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3558 { // arbitrary precision integer constants
3559 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3560 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3561 GEN_ERROR("Constant value does not fit in type");
3563 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3564 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3565 delete yyvsp[0].APIntVal;
3570 #line 1854 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3571 { // Boolean constants
3572 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3573 yyval.ConstVal = ConstantInt::getTrue();
3578 #line 1859 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3579 { // Boolean constants
3580 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3581 yyval.ConstVal = ConstantInt::getFalse();
3586 #line 1864 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3587 { // Float & Double constants
3588 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
3589 GEN_ERROR("Floating point constant invalid for type");
3590 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
3595 #line 1872 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3597 if (!UpRefs.empty())
3598 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3599 Constant *Val = yyvsp[-3].ConstVal;
3600 const Type *DestTy = yyvsp[-1].TypeVal->get();
3601 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3602 GEN_ERROR("invalid cast opcode for cast from '" +
3603 Val->getType()->getDescription() + "' to '" +
3604 DestTy->getDescription() + "'");
3605 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3606 delete yyvsp[-1].TypeVal;
3610 #line 1884 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3612 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3613 GEN_ERROR("GetElementPtr requires a pointer operand");
3616 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), &(*yyvsp[-1].ValueList)[0], yyvsp[-1].ValueList->size(),
3619 GEN_ERROR("Index list invalid for constant getelementptr");
3621 SmallVector<Constant*, 8> IdxVec;
3622 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3623 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3624 IdxVec.push_back(C);
3626 GEN_ERROR("Indices to constant getelementptr must be constants");
3628 delete yyvsp[-1].ValueList;
3630 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3635 #line 1906 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3637 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3638 GEN_ERROR("Select condition must be of boolean type");
3639 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3640 GEN_ERROR("Select operand types must match");
3641 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3646 #line 1914 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3648 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3649 GEN_ERROR("Binary operator types must match");
3651 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3655 #line 1920 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3657 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3658 GEN_ERROR("Logical operator types must match");
3659 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3660 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3661 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3662 GEN_ERROR("Logical operator requires integral operands");
3664 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3669 #line 1931 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3671 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3672 GEN_ERROR("icmp operand types must match");
3673 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3677 #line 1936 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3679 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3680 GEN_ERROR("fcmp operand types must match");
3681 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3685 #line 1941 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3687 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3688 GEN_ERROR("Invalid extractelement operands");
3689 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3694 #line 1947 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3696 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3697 GEN_ERROR("Invalid insertelement operands");
3698 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3703 #line 1953 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3705 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3706 GEN_ERROR("Invalid shufflevector operands");
3707 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3712 #line 1962 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3714 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3719 #line 1966 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3721 yyval.ConstVector = new std::vector<Constant*>();
3722 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3727 #line 1974 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3728 { yyval.BoolVal = false; ;
3731 #line 1974 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3732 { yyval.BoolVal = true; ;
3735 #line 1977 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3736 { yyval.BoolVal = true; ;
3739 #line 1977 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3740 { yyval.BoolVal = false; ;
3743 #line 1980 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3745 const Type* VTy = yyvsp[-1].TypeVal->get();
3746 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3748 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3750 GEN_ERROR("Aliases can be created only to global values");
3752 yyval.ConstVal = Aliasee;
3754 delete yyvsp[-1].TypeVal;
3758 #line 1992 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3760 Constant *Val = yyvsp[-3].ConstVal;
3761 const Type *DestTy = yyvsp[-1].TypeVal->get();
3762 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3763 GEN_ERROR("invalid cast opcode for cast from '" +
3764 Val->getType()->getDescription() + "' to '" +
3765 DestTy->getDescription() + "'");
3767 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3769 delete yyvsp[-1].TypeVal;
3773 #line 2013 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3775 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3776 CurModule.ModuleDone();
3781 #line 2018 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3783 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3784 CurModule.ModuleDone();
3789 #line 2031 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3790 { CurFun.isDeclare = false; ;
3793 #line 2031 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3795 CurFun.FunctionDone();
3800 #line 2035 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3801 { CurFun.isDeclare = true; ;
3804 #line 2035 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3810 #line 2038 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3816 #line 2041 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3818 if (!UpRefs.empty())
3819 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3820 // Eagerly resolve types. This is not an optimization, this is a
3821 // requirement that is due to the fact that we could have this:
3823 // %list = type { %list * }
3824 // %list = type { %list * } ; repeated type decl
3826 // If types are not resolved eagerly, then the two types will not be
3827 // determined to be the same type!
3829 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3831 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3833 // If this is a named type that is not a redefinition, add it to the slot
3835 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3838 delete yyvsp[0].TypeVal;
3843 #line 2065 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3845 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3847 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3849 // If this is a named type that is not a redefinition, add it to the slot
3851 CurModule.Types.push_back(yyvsp[0].PrimType);
3857 #line 2076 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3859 /* "Externally Visible" Linkage */
3860 if (yyvsp[0].ConstVal == 0)
3861 GEN_ERROR("Global value initializer is not a constant");
3862 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3863 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3868 #line 2083 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3874 #line 2087 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3876 if (yyvsp[0].ConstVal == 0)
3877 GEN_ERROR("Global value initializer is not a constant");
3878 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3883 #line 2092 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3889 #line 2096 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3891 if (!UpRefs.empty())
3892 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3893 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
3895 delete yyvsp[0].TypeVal;
3899 #line 2102 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3906 #line 2106 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3909 if (yyvsp[-4].StrVal) {
3910 Name = *yyvsp[-4].StrVal;
3911 delete yyvsp[-4].StrVal;
3914 GEN_ERROR("Alias name cannot be empty");
3916 Constant* Aliasee = yyvsp[0].ConstVal;
3918 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3920 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
3921 CurModule.CurrentModule);
3922 GA->setVisibility(yyvsp[-3].Visibility);
3923 InsertValue(GA, CurModule.Values);
3928 #line 2125 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3934 #line 2128 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3940 #line 2134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3942 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3943 if (AsmSoFar.empty())
3944 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
3946 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
3947 delete yyvsp[0].StrVal;
3952 #line 2144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3954 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
3955 delete yyvsp[0].StrVal;
3959 #line 2148 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3961 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
3962 delete yyvsp[0].StrVal;
3966 #line 2155 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3968 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3969 delete yyvsp[0].StrVal;
3974 #line 2160 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3976 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3977 delete yyvsp[0].StrVal;
3982 #line 2165 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3988 #line 2174 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3990 if (!UpRefs.empty())
3991 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3992 if (*yyvsp[-2].TypeVal == Type::VoidTy)
3993 GEN_ERROR("void typed arguments are invalid");
3994 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
3995 yyval.ArgList = yyvsp[-4].ArgList;
3996 yyvsp[-4].ArgList->push_back(E);
4001 #line 2184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4003 if (!UpRefs.empty())
4004 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4005 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4006 GEN_ERROR("void typed arguments are invalid");
4007 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4008 yyval.ArgList = new ArgListType;
4009 yyval.ArgList->push_back(E);
4014 #line 2195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4016 yyval.ArgList = yyvsp[0].ArgList;
4021 #line 2199 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4023 yyval.ArgList = yyvsp[-2].ArgList;
4024 struct ArgListEntry E;
4025 E.Ty = new PATypeHolder(Type::VoidTy);
4027 E.Attrs = ParamAttr::None;
4028 yyval.ArgList->push_back(E);
4033 #line 2208 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4035 yyval.ArgList = new ArgListType;
4036 struct ArgListEntry E;
4037 E.Ty = new PATypeHolder(Type::VoidTy);
4039 E.Attrs = ParamAttr::None;
4040 yyval.ArgList->push_back(E);
4045 #line 2217 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4052 #line 2223 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4054 std::string FunctionName(*yyvsp[-6].StrVal);
4055 delete yyvsp[-6].StrVal; // Free strdup'd memory!
4057 // Check the function result for abstractness if this is a define. We should
4058 // have no abstract types at this point
4059 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4060 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4062 std::vector<const Type*> ParamTypeList;
4063 ParamAttrsVector Attrs;
4064 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4065 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4066 Attrs.push_back(PAWI);
4068 if (yyvsp[-4].ArgList) { // If there are arguments...
4070 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4071 const Type* Ty = I->Ty->get();
4072 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4073 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4074 ParamTypeList.push_back(Ty);
4075 if (Ty != Type::VoidTy)
4076 if (I->Attrs != ParamAttr::None) {
4077 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4078 Attrs.push_back(PAWI);
4083 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4084 if (isVarArg) ParamTypeList.pop_back();
4086 ParamAttrsList *PAL = 0;
4088 PAL = ParamAttrsList::get(Attrs);
4090 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4091 const PointerType *PFT = PointerType::get(FT);
4092 delete yyvsp[-7].TypeVal;
4095 if (!FunctionName.empty()) {
4096 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4098 ID = ValID::createGlobalID(CurModule.Values.size());
4102 // See if this function was forward referenced. If so, recycle the object.
4103 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4104 // Move the function to the end of the list, from whereever it was
4105 // previously inserted.
4106 Fn = cast<Function>(FWRef);
4107 CurModule.CurrentModule->getFunctionList().remove(Fn);
4108 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4109 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4110 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4111 if (Fn->getFunctionType() != FT) {
4112 // The existing function doesn't have the same type. This is an overload
4114 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4115 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4116 // Neither the existing or the current function is a declaration and they
4117 // have the same name and same type. Clearly this is a redefinition.
4118 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4119 } if (Fn->isDeclaration()) {
4120 // Make sure to strip off any argument names so we can't get conflicts.
4121 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4125 } else { // Not already defined?
4126 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4127 CurModule.CurrentModule);
4129 InsertValue(Fn, CurModule.Values);
4132 CurFun.FunctionStart(Fn);
4134 if (CurFun.isDeclare) {
4135 // If we have declaration, always overwrite linkage. This will allow us to
4136 // correctly handle cases, when pointer to function is passed as argument to
4137 // another function.
4138 Fn->setLinkage(CurFun.Linkage);
4139 Fn->setVisibility(CurFun.Visibility);
4141 Fn->setCallingConv(yyvsp[-8].UIntVal);
4142 Fn->setAlignment(yyvsp[0].UIntVal);
4143 if (yyvsp[-1].StrVal) {
4144 Fn->setSection(*yyvsp[-1].StrVal);
4145 delete yyvsp[-1].StrVal;
4148 // Add all of the arguments we parsed to the function...
4149 if (yyvsp[-4].ArgList) { // Is null if empty...
4150 if (isVarArg) { // Nuke the last entry
4151 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4152 "Not a varargs marker!");
4153 delete yyvsp[-4].ArgList->back().Ty;
4154 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4156 Function::arg_iterator ArgIt = Fn->arg_begin();
4157 Function::arg_iterator ArgEnd = Fn->arg_end();
4159 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4160 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4161 delete I->Ty; // Delete the typeholder...
4162 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4168 delete yyvsp[-4].ArgList; // We're now done with the argument list
4174 #line 2345 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4176 yyval.FunctionVal = CurFun.CurrentFunction;
4178 // Make sure that we keep track of the linkage type even if there was a
4179 // previous "declare".
4180 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4181 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4185 #line 2356 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4187 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4192 #line 2361 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4194 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4195 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4196 yyval.FunctionVal = CurFun.CurrentFunction;
4197 CurFun.FunctionDone();
4202 #line 2373 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4204 yyval.BoolVal = false;
4209 #line 2377 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4211 yyval.BoolVal = true;
4216 #line 2382 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4217 { // A reference to a direct constant
4218 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4223 #line 2386 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4225 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4230 #line 2390 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4231 { // Perhaps it's an FP constant?
4232 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4237 #line 2394 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4239 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4244 #line 2398 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4246 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4251 #line 2402 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4253 yyval.ValIDVal = ValID::createNull();
4258 #line 2406 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4260 yyval.ValIDVal = ValID::createUndef();
4265 #line 2410 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4266 { // A vector zero constant.
4267 yyval.ValIDVal = ValID::createZeroInit();
4272 #line 2414 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4273 { // Nonempty unsized packed vector
4274 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4275 int NumElements = yyvsp[-1].ConstVector->size();
4277 VectorType* pt = VectorType::get(ETy, NumElements);
4278 PATypeHolder* PTy = new PATypeHolder(
4286 // Verify all elements are correct type!
4287 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4288 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4289 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4290 ETy->getDescription() +"' as required!\nIt is of type '" +
4291 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4294 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4295 delete PTy; delete yyvsp[-1].ConstVector;
4300 #line 2439 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4302 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4307 #line 2443 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4309 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4310 delete yyvsp[-2].StrVal;
4311 delete yyvsp[0].StrVal;
4316 #line 2453 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4317 { // Is it an integer reference...?
4318 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4323 #line 2457 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4325 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4330 #line 2461 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4331 { // Is it a named reference...?
4332 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4333 delete yyvsp[0].StrVal;
4338 #line 2466 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4339 { // Is it a named reference...?
4340 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4341 delete yyvsp[0].StrVal;
4346 #line 2479 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4348 if (!UpRefs.empty())
4349 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4350 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4351 delete yyvsp[-1].TypeVal;
4356 #line 2488 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4358 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4363 #line 2492 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4364 { // Do not allow functions with 0 basic blocks
4365 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4370 #line 2501 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4372 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4374 InsertValue(yyvsp[0].TermInstVal);
4375 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4376 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4381 #line 2510 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4383 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4384 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4385 if (CI2->getParent() == 0)
4386 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4387 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4388 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4393 #line 2519 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4394 { // Empty space between instruction lists
4395 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4400 #line 2523 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4401 { // Labelled (named) basic block
4402 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4403 delete yyvsp[0].StrVal;
4409 #line 2530 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4410 { // Return with a result...
4411 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4416 #line 2534 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4417 { // Return with no result...
4418 yyval.TermInstVal = new ReturnInst();
4423 #line 2538 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4424 { // Unconditional Branch...
4425 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4427 yyval.TermInstVal = new BranchInst(tmpBB);
4431 #line 2543 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4433 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4434 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4436 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4438 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4440 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4444 #line 2553 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4446 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4448 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4450 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4451 yyval.TermInstVal = S;
4453 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4454 E = yyvsp[-1].JumpTable->end();
4455 for (; I != E; ++I) {
4456 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4457 S->addCase(CI, I->second);
4459 GEN_ERROR("Switch case is constant, but not a simple integer");
4461 delete yyvsp[-1].JumpTable;
4466 #line 2572 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4468 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4470 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4472 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4473 yyval.TermInstVal = S;
4478 #line 2582 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4481 // Handle the short syntax
4482 const PointerType *PFTy = 0;
4483 const FunctionType *Ty = 0;
4484 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4485 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4486 // Pull out the types of all of the arguments...
4487 std::vector<const Type*> ParamTypes;
4488 ParamAttrsVector Attrs;
4489 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4490 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4491 Attrs.push_back(PAWI);
4493 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
4495 for (; I != E; ++I, ++index) {
4496 const Type *Ty = I->Val->getType();
4497 if (Ty == Type::VoidTy)
4498 GEN_ERROR("Short call syntax cannot be used with varargs");
4499 ParamTypes.push_back(Ty);
4500 if (I->Attrs != ParamAttr::None) {
4501 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4502 Attrs.push_back(PAWI);
4506 ParamAttrsList *PAL = 0;
4508 PAL = ParamAttrsList::get(Attrs);
4509 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
4510 PFTy = PointerType::get(Ty);
4513 delete yyvsp[-11].TypeVal;
4515 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4517 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4519 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4522 // Check the arguments
4524 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
4525 // Make sure no arguments is a good thing!
4526 if (Ty->getNumParams() != 0)
4527 GEN_ERROR("No arguments passed to a function that "
4528 "expects arguments");
4529 } else { // Has arguments?
4530 // Loop through FunctionType's arguments and ensure they are specified
4532 FunctionType::param_iterator I = Ty->param_begin();
4533 FunctionType::param_iterator E = Ty->param_end();
4534 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
4536 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4537 if (ArgI->Val->getType() != *I)
4538 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4539 (*I)->getDescription() + "'");
4540 Args.push_back(ArgI->Val);
4543 if (Ty->isVarArg()) {
4545 for (; ArgI != ArgE; ++ArgI)
4546 Args.push_back(ArgI->Val); // push the remaining varargs
4547 } else if (I != E || ArgI != ArgE)
4548 GEN_ERROR("Invalid number of parameters detected");
4551 // Create the InvokeInst
4552 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
4553 II->setCallingConv(yyvsp[-12].UIntVal);
4554 yyval.TermInstVal = II;
4555 delete yyvsp[-8].ValueRefList;
4560 #line 2661 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4562 yyval.TermInstVal = new UnwindInst();
4567 #line 2665 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4569 yyval.TermInstVal = new UnreachableInst();
4574 #line 2672 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4576 yyval.JumpTable = yyvsp[-5].JumpTable;
4577 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4580 GEN_ERROR("May only switch on a constant pool value");
4582 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4584 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4588 #line 2683 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4590 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4591 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4595 GEN_ERROR("May only switch on a constant pool value");
4597 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4599 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4603 #line 2696 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4605 // Is this definition named?? if so, assign the name...
4606 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4608 InsertValue(yyvsp[0].InstVal);
4609 yyval.InstVal = yyvsp[0].InstVal;
4614 #line 2706 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4615 { // Used for PHI nodes
4616 if (!UpRefs.empty())
4617 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4618 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4619 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4621 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4623 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4624 delete yyvsp[-5].TypeVal;
4628 #line 2717 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4630 yyval.PHIList = yyvsp[-6].PHIList;
4631 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4633 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4635 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4639 #line 2727 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4641 if (!UpRefs.empty())
4642 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4643 // Used for call and invoke instructions
4644 yyval.ValueRefList = new ValueRefList();
4645 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4646 yyval.ValueRefList->push_back(E);
4647 delete yyvsp[-2].TypeVal;
4651 #line 2736 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4653 if (!UpRefs.empty())
4654 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4655 yyval.ValueRefList = yyvsp[-4].ValueRefList;
4656 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4657 yyval.ValueRefList->push_back(E);
4658 delete yyvsp[-2].TypeVal;
4663 #line 2745 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4664 { yyval.ValueRefList = new ValueRefList(); ;
4667 #line 2748 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4668 { yyval.ValueList = new std::vector<Value*>(); ;
4671 #line 2749 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4673 yyval.ValueList = yyvsp[-2].ValueList;
4674 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4679 #line 2756 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4681 yyval.BoolVal = true;
4686 #line 2760 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4688 yyval.BoolVal = false;
4693 #line 2765 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4695 if (!UpRefs.empty())
4696 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4697 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4698 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4700 "Arithmetic operator requires integer, FP, or packed operands");
4701 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4702 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4703 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4704 yyvsp[-4].BinaryOpVal == Instruction::FRem))
4705 GEN_ERROR("Remainder not supported on vector types");
4706 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4708 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4710 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4711 if (yyval.InstVal == 0)
4712 GEN_ERROR("binary operator returned null");
4713 delete yyvsp[-3].TypeVal;
4717 #line 2786 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4719 if (!UpRefs.empty())
4720 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4721 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4722 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4723 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4724 GEN_ERROR("Logical operator requires integral operands");
4726 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4728 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4730 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4731 if (yyval.InstVal == 0)
4732 GEN_ERROR("binary operator returned null");
4733 delete yyvsp[-3].TypeVal;
4737 #line 2803 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4739 if (!UpRefs.empty())
4740 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4741 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4742 GEN_ERROR("Vector types not supported by icmp instruction");
4743 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4745 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4747 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4748 if (yyval.InstVal == 0)
4749 GEN_ERROR("icmp operator returned null");
4750 delete yyvsp[-3].TypeVal;
4754 #line 2817 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4756 if (!UpRefs.empty())
4757 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4758 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4759 GEN_ERROR("Vector types not supported by fcmp instruction");
4760 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4762 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4764 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4765 if (yyval.InstVal == 0)
4766 GEN_ERROR("fcmp operator returned null");
4767 delete yyvsp[-3].TypeVal;
4771 #line 2831 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4773 if (!UpRefs.empty())
4774 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4775 Value* Val = yyvsp[-2].ValueVal;
4776 const Type* DestTy = yyvsp[0].TypeVal->get();
4777 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4778 GEN_ERROR("invalid cast opcode for cast from '" +
4779 Val->getType()->getDescription() + "' to '" +
4780 DestTy->getDescription() + "'");
4781 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4782 delete yyvsp[0].TypeVal;
4786 #line 2843 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4788 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4789 GEN_ERROR("select condition must be boolean");
4790 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4791 GEN_ERROR("select value types should match");
4792 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4797 #line 2851 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4799 if (!UpRefs.empty())
4800 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4801 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4802 delete yyvsp[0].TypeVal;
4807 #line 2858 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4809 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4810 GEN_ERROR("Invalid extractelement operands");
4811 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4816 #line 2864 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4818 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4819 GEN_ERROR("Invalid insertelement operands");
4820 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4825 #line 2870 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4827 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4828 GEN_ERROR("Invalid shufflevector operands");
4829 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4834 #line 2876 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4836 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4837 if (!Ty->isFirstClassType())
4838 GEN_ERROR("PHI node operands must be of first class type");
4839 yyval.InstVal = new PHINode(Ty);
4840 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4841 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4842 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4843 GEN_ERROR("All elements of a PHI node must be of the same type");
4844 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4845 yyvsp[0].PHIList->pop_front();
4847 delete yyvsp[0].PHIList; // Free the list...
4852 #line 2892 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4855 // Handle the short syntax
4856 const PointerType *PFTy = 0;
4857 const FunctionType *Ty = 0;
4858 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
4859 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4860 // Pull out the types of all of the arguments...
4861 std::vector<const Type*> ParamTypes;
4862 ParamAttrsVector Attrs;
4863 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4864 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
4865 Attrs.push_back(PAWI);
4868 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
4869 for (; I != E; ++I, ++index) {
4870 const Type *Ty = I->Val->getType();
4871 if (Ty == Type::VoidTy)
4872 GEN_ERROR("Short call syntax cannot be used with varargs");
4873 ParamTypes.push_back(Ty);
4874 if (I->Attrs != ParamAttr::None) {
4875 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4876 Attrs.push_back(PAWI);
4880 ParamAttrsList *PAL = 0;
4882 PAL = ParamAttrsList::get(Attrs);
4884 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
4885 PFTy = PointerType::get(Ty);
4888 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
4891 // Check for call to invalid intrinsic to avoid crashing later.
4892 if (Function *theF = dyn_cast<Function>(V)) {
4893 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4894 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4895 !theF->getIntrinsicID(true))
4896 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4897 theF->getName() + "'");
4900 // Check the arguments
4902 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
4903 // Make sure no arguments is a good thing!
4904 if (Ty->getNumParams() != 0)
4905 GEN_ERROR("No arguments passed to a function that "
4906 "expects arguments");
4907 } else { // Has arguments?
4908 // Loop through FunctionType's arguments and ensure they are specified
4911 FunctionType::param_iterator I = Ty->param_begin();
4912 FunctionType::param_iterator E = Ty->param_end();
4913 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
4915 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4916 if (ArgI->Val->getType() != *I)
4917 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4918 (*I)->getDescription() + "'");
4919 Args.push_back(ArgI->Val);
4921 if (Ty->isVarArg()) {
4923 for (; ArgI != ArgE; ++ArgI)
4924 Args.push_back(ArgI->Val); // push the remaining varargs
4925 } else if (I != E || ArgI != ArgE)
4926 GEN_ERROR("Invalid number of parameters detected");
4928 // Create the call node
4929 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
4930 CI->setTailCall(yyvsp[-7].BoolVal);
4931 CI->setCallingConv(yyvsp[-6].UIntVal);
4933 delete yyvsp[-2].ValueRefList;
4934 delete yyvsp[-5].TypeVal;
4939 #line 2976 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4941 yyval.InstVal = yyvsp[0].InstVal;
4946 #line 2981 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4948 yyval.BoolVal = true;
4953 #line 2985 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4955 yyval.BoolVal = false;
4960 #line 2992 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4962 if (!UpRefs.empty())
4963 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4964 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4965 delete yyvsp[-1].TypeVal;
4970 #line 2999 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4972 if (!UpRefs.empty())
4973 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
4974 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4976 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4977 delete yyvsp[-4].TypeVal;
4981 #line 3007 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4983 if (!UpRefs.empty())
4984 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4985 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4986 delete yyvsp[-1].TypeVal;
4991 #line 3014 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4993 if (!UpRefs.empty())
4994 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
4995 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4997 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4998 delete yyvsp[-4].TypeVal;
5002 #line 3022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5004 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5005 GEN_ERROR("Trying to free nonpointer type " +
5006 yyvsp[0].ValueVal->getType()->getDescription() + "");
5007 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5012 #line 3030 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5014 if (!UpRefs.empty())
5015 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5016 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5017 GEN_ERROR("Can't load from nonpointer type: " +
5018 (*yyvsp[-2].TypeVal)->getDescription());
5019 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5020 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5021 (*yyvsp[-2].TypeVal)->getDescription());
5022 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5024 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5025 delete yyvsp[-2].TypeVal;
5029 #line 3044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5031 if (!UpRefs.empty())
5032 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5033 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5035 GEN_ERROR("Can't store to a nonpointer type: " +
5036 (*yyvsp[-2].TypeVal)->getDescription());
5037 const Type *ElTy = PT->getElementType();
5038 if (ElTy != yyvsp[-4].ValueVal->getType())
5039 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5040 "' into space of type '" + ElTy->getDescription() + "'");
5042 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5044 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5045 delete yyvsp[-2].TypeVal;
5049 #line 3061 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5051 if (!UpRefs.empty())
5052 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5053 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5054 GEN_ERROR("getelementptr insn requires pointer operand");
5056 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size(), true))
5057 GEN_ERROR("Invalid getelementptr indices for type '" +
5058 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5059 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5061 yyval.InstVal = new GetElementPtrInst(tmpVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size());
5062 delete yyvsp[-2].TypeVal;
5063 delete yyvsp[0].ValueList;
5067 /* the action file gets copied in in place of this dollarsign */
5068 #line 543 "/usr/share/bison.simple"
5079 short *ssp1 = yyss - 1;
5080 fprintf (stderr, "state stack now");
5081 while (ssp1 != yyssp)
5082 fprintf (stderr, " %d", *++ssp1);
5083 fprintf (stderr, "\n");
5093 yylsp->first_line = yylloc.first_line;
5094 yylsp->first_column = yylloc.first_column;
5095 yylsp->last_line = (yylsp-1)->last_line;
5096 yylsp->last_column = (yylsp-1)->last_column;
5101 yylsp->last_line = (yylsp+yylen-1)->last_line;
5102 yylsp->last_column = (yylsp+yylen-1)->last_column;
5106 /* Now "shift" the result of the reduction.
5107 Determine what state that goes to,
5108 based on the state we popped back to
5109 and the rule number reduced by. */
5113 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5114 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5115 yystate = yytable[yystate];
5117 yystate = yydefgoto[yyn - YYNTBASE];
5121 yyerrlab: /* here on detecting error */
5124 /* If not already recovering from an error, report this error. */
5128 #ifdef YYERROR_VERBOSE
5129 yyn = yypact[yystate];
5131 if (yyn > YYFLAG && yyn < YYLAST)
5138 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5139 for (x = (yyn < 0 ? -yyn : 0);
5140 x < (sizeof(yytname) / sizeof(char *)); x++)
5141 if (yycheck[x + yyn] == x)
5142 size += strlen(yytname[x]) + 15, count++;
5143 msg = (char *) malloc(size + 15);
5146 strcpy(msg, "parse error");
5151 for (x = (yyn < 0 ? -yyn : 0);
5152 x < (sizeof(yytname) / sizeof(char *)); x++)
5153 if (yycheck[x + yyn] == x)
5155 strcat(msg, count == 0 ? ", expecting `" : " or `");
5156 strcat(msg, yytname[x]);
5165 yyerror ("parse error; also virtual memory exceeded");
5168 #endif /* YYERROR_VERBOSE */
5169 yyerror("parse error");
5173 yyerrlab1: /* here on error raised explicitly by an action */
5175 if (yyerrstatus == 3)
5177 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5179 /* return failure if at end of input */
5180 if (yychar == YYEOF)
5185 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5191 /* Else will try to reuse lookahead token
5192 after shifting the error token. */
5194 yyerrstatus = 3; /* Each real token shifted decrements this */
5198 yyerrdefault: /* current state does not do anything special for the error token. */
5201 /* This is wrong; only states that explicitly want error tokens
5202 should shift them. */
5203 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5204 if (yyn) goto yydefault;
5207 yyerrpop: /* pop the current state because it cannot handle the error token */
5209 if (yyssp == yyss) YYABORT;
5219 short *ssp1 = yyss - 1;
5220 fprintf (stderr, "Error: state stack now");
5221 while (ssp1 != yyssp)
5222 fprintf (stderr, " %d", *++ssp1);
5223 fprintf (stderr, "\n");
5229 yyn = yypact[yystate];
5234 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5253 fprintf(stderr, "Shifting error token, ");
5265 /* YYACCEPT comes here. */
5277 /* YYABORT comes here. */
5288 #line 3078 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5291 // common code from the two 'RunVMAsmParser' functions
5292 static Module* RunParser(Module * M) {
5294 llvmAsmlineno = 1; // Reset the current line number...
5295 CurModule.CurrentModule = M;
5300 // Check to make sure the parser succeeded
5303 delete ParserResult;
5307 // Emit an error if there are any unresolved types left.
5308 if (!CurModule.LateResolveTypes.empty()) {
5309 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5310 if (DID.Type == ValID::LocalName) {
5311 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5313 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5316 delete ParserResult;
5320 // Emit an error if there are any unresolved values left.
5321 if (!CurModule.LateResolveValues.empty()) {
5322 Value *V = CurModule.LateResolveValues.back();
5323 std::map<Value*, std::pair<ValID, int> >::iterator I =
5324 CurModule.PlaceHolderInfo.find(V);
5326 if (I != CurModule.PlaceHolderInfo.end()) {
5327 ValID &DID = I->second.first;
5328 if (DID.Type == ValID::LocalName) {
5329 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5331 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5334 delete ParserResult;
5339 // Check to make sure that parsing produced a result
5343 // Reset ParserResult variable while saving its value for the result.
5344 Module *Result = ParserResult;
5350 void llvm::GenerateError(const std::string &message, int LineNo) {
5351 if (LineNo == -1) LineNo = llvmAsmlineno;
5352 // TODO: column number in exception
5354 TheParseError->setError(CurFilename, message, LineNo);
5358 int yyerror(const char *ErrorMsg) {
5360 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5361 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5362 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5363 if (yychar != YYEMPTY && yychar != 0)
5364 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5366 GenerateError(errMsg);