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 // Lexer has no type info, so builds all FP constants as double.
566 if (Ty==Type::FloatTy)
567 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
568 return ConstantFP::get(Ty, *D.ConstPoolFP);
570 case ValID::ConstNullVal: // Is it a null value?
571 if (!isa<PointerType>(Ty)) {
572 GenerateError("Cannot create a a non pointer null");
575 return ConstantPointerNull::get(cast<PointerType>(Ty));
577 case ValID::ConstUndefVal: // Is it an undef value?
578 return UndefValue::get(Ty);
580 case ValID::ConstZeroVal: // Is it a zero value?
581 return Constant::getNullValue(Ty);
583 case ValID::ConstantVal: // Fully resolved constant?
584 if (D.ConstantValue->getType() != Ty) {
585 GenerateError("Constant expression type different from required type");
588 return D.ConstantValue;
590 case ValID::InlineAsmVal: { // Inline asm expression
591 const PointerType *PTy = dyn_cast<PointerType>(Ty);
592 const FunctionType *FTy =
593 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
594 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
595 GenerateError("Invalid type for asm constraint string");
598 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
599 D.IAD->HasSideEffects);
600 D.destroy(); // Free InlineAsmDescriptor.
604 assert(0 && "Unhandled case!");
608 assert(0 && "Unhandled case!");
612 // getVal - This function is identical to getExistingVal, except that if a
613 // value is not already defined, it "improvises" by creating a placeholder var
614 // that looks and acts just like the requested variable. When the value is
615 // defined later, all uses of the placeholder variable are replaced with the
618 static Value *getVal(const Type *Ty, const ValID &ID) {
619 if (Ty == Type::LabelTy) {
620 GenerateError("Cannot use a basic block here");
624 // See if the value has already been defined.
625 Value *V = getExistingVal(Ty, ID);
627 if (TriggerError) return 0;
629 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
630 GenerateError("Invalid use of a composite type");
634 // If we reached here, we referenced either a symbol that we don't know about
635 // or an id number that hasn't been read yet. We may be referencing something
636 // forward, so just create an entry to be resolved later and get to it...
639 case ValID::GlobalName:
640 case ValID::GlobalID: {
641 const PointerType *PTy = dyn_cast<PointerType>(Ty);
643 GenerateError("Invalid type for reference to global" );
646 const Type* ElTy = PTy->getElementType();
647 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
648 V = new Function(FTy, GlobalValue::ExternalLinkage);
650 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
654 V = new Argument(Ty);
657 // Remember where this forward reference came from. FIXME, shouldn't we try
658 // to recycle these things??
659 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
662 if (inFunctionScope())
663 InsertValue(V, CurFun.LateResolveValues);
665 InsertValue(V, CurModule.LateResolveValues);
669 /// defineBBVal - This is a definition of a new basic block with the specified
670 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
671 static BasicBlock *defineBBVal(const ValID &ID) {
672 assert(inFunctionScope() && "Can't get basic block at global scope!");
676 // First, see if this was forward referenced
678 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
679 if (BBI != CurFun.BBForwardRefs.end()) {
681 // The forward declaration could have been inserted anywhere in the
682 // function: insert it into the correct place now.
683 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
684 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
686 // We're about to erase the entry, save the key so we can clean it up.
687 ValID Tmp = BBI->first;
689 // Erase the forward ref from the map as its no longer "forward"
690 CurFun.BBForwardRefs.erase(ID);
692 // The key has been removed from the map but so we don't want to leave
693 // strdup'd memory around so destroy it too.
696 // If its a numbered definition, bump the number and set the BB value.
697 if (ID.Type == ValID::LocalID) {
698 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
706 // We haven't seen this BB before and its first mention is a definition.
707 // Just create it and return it.
708 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
709 BB = new BasicBlock(Name, CurFun.CurrentFunction);
710 if (ID.Type == ValID::LocalID) {
711 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
715 ID.destroy(); // Free strdup'd memory
719 /// getBBVal - get an existing BB value or create a forward reference for it.
721 static BasicBlock *getBBVal(const ValID &ID) {
722 assert(inFunctionScope() && "Can't get basic block at global scope!");
726 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
727 if (BBI != CurFun.BBForwardRefs.end()) {
729 } if (ID.Type == ValID::LocalName) {
730 std::string Name = ID.getName();
731 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
733 if (N->getType()->getTypeID() == Type::LabelTyID)
734 BB = cast<BasicBlock>(N);
736 GenerateError("Reference to label '" + Name + "' is actually of type '"+
737 N->getType()->getDescription() + "'");
738 } else if (ID.Type == ValID::LocalID) {
739 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
740 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
741 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
743 GenerateError("Reference to label '%" + utostr(ID.Num) +
744 "' is actually of type '"+
745 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
748 GenerateError("Illegal label reference " + ID.getName());
752 // If its already been defined, return it now.
754 ID.destroy(); // Free strdup'd memory.
758 // Otherwise, this block has not been seen before, create it.
760 if (ID.Type == ValID::LocalName)
762 BB = new BasicBlock(Name, CurFun.CurrentFunction);
764 // Insert it in the forward refs map.
765 CurFun.BBForwardRefs[ID] = BB;
771 //===----------------------------------------------------------------------===//
772 // Code to handle forward references in instructions
773 //===----------------------------------------------------------------------===//
775 // This code handles the late binding needed with statements that reference
776 // values not defined yet... for example, a forward branch, or the PHI node for
779 // This keeps a table (CurFun.LateResolveValues) of all such forward references
780 // and back patchs after we are done.
783 // ResolveDefinitions - If we could not resolve some defs at parsing
784 // time (forward branches, phi functions for loops, etc...) resolve the
788 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
789 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
790 while (!LateResolvers.empty()) {
791 Value *V = LateResolvers.back();
792 LateResolvers.pop_back();
794 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
795 CurModule.PlaceHolderInfo.find(V);
796 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
798 ValID &DID = PHI->second.first;
800 Value *TheRealValue = getExistingVal(V->getType(), DID);
804 V->replaceAllUsesWith(TheRealValue);
806 CurModule.PlaceHolderInfo.erase(PHI);
807 } else if (FutureLateResolvers) {
808 // Functions have their unresolved items forwarded to the module late
810 InsertValue(V, *FutureLateResolvers);
812 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
813 GenerateError("Reference to an invalid definition: '" +DID.getName()+
814 "' of type '" + V->getType()->getDescription() + "'",
818 GenerateError("Reference to an invalid definition: #" +
819 itostr(DID.Num) + " of type '" +
820 V->getType()->getDescription() + "'",
826 LateResolvers.clear();
829 // ResolveTypeTo - A brand new type was just declared. This means that (if
830 // name is not null) things referencing Name can be resolved. Otherwise, things
831 // refering to the number can be resolved. Do this now.
833 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
836 D = ValID::createLocalName(*Name);
838 D = ValID::createLocalID(CurModule.Types.size());
840 std::map<ValID, PATypeHolder>::iterator I =
841 CurModule.LateResolveTypes.find(D);
842 if (I != CurModule.LateResolveTypes.end()) {
843 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
844 CurModule.LateResolveTypes.erase(I);
848 // setValueName - Set the specified value to the name given. The name may be
849 // null potentially, in which case this is a noop. The string passed in is
850 // assumed to be a malloc'd string buffer, and is free'd by this function.
852 static void setValueName(Value *V, std::string *NameStr) {
853 if (!NameStr) return;
854 std::string Name(*NameStr); // Copy string
855 delete NameStr; // Free old string
857 if (V->getType() == Type::VoidTy) {
858 GenerateError("Can't assign name '" + Name+"' to value with void type");
862 assert(inFunctionScope() && "Must be in function scope!");
863 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
864 if (ST.lookup(Name)) {
865 GenerateError("Redefinition of value '" + Name + "' of type '" +
866 V->getType()->getDescription() + "'");
874 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
875 /// this is a declaration, otherwise it is a definition.
876 static GlobalVariable *
877 ParseGlobalVariable(std::string *NameStr,
878 GlobalValue::LinkageTypes Linkage,
879 GlobalValue::VisibilityTypes Visibility,
880 bool isConstantGlobal, const Type *Ty,
881 Constant *Initializer, bool IsThreadLocal) {
882 if (isa<FunctionType>(Ty)) {
883 GenerateError("Cannot declare global vars of function type");
887 const PointerType *PTy = PointerType::get(Ty);
891 Name = *NameStr; // Copy string
892 delete NameStr; // Free old string
895 // See if this global value was forward referenced. If so, recycle the
899 ID = ValID::createGlobalName(Name);
901 ID = ValID::createGlobalID(CurModule.Values.size());
904 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
905 // Move the global to the end of the list, from whereever it was
906 // previously inserted.
907 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
908 CurModule.CurrentModule->getGlobalList().remove(GV);
909 CurModule.CurrentModule->getGlobalList().push_back(GV);
910 GV->setInitializer(Initializer);
911 GV->setLinkage(Linkage);
912 GV->setVisibility(Visibility);
913 GV->setConstant(isConstantGlobal);
914 GV->setThreadLocal(IsThreadLocal);
915 InsertValue(GV, CurModule.Values);
919 // If this global has a name
921 // if the global we're parsing has an initializer (is a definition) and
922 // has external linkage.
923 if (Initializer && Linkage != GlobalValue::InternalLinkage)
924 // If there is already a global with external linkage with this name
925 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
926 // If we allow this GVar to get created, it will be renamed in the
927 // symbol table because it conflicts with an existing GVar. We can't
928 // allow redefinition of GVars whose linking indicates that their name
929 // must stay the same. Issue the error.
930 GenerateError("Redefinition of global variable named '" + Name +
931 "' of type '" + Ty->getDescription() + "'");
936 // Otherwise there is no existing GV to use, create one now.
938 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
939 CurModule.CurrentModule, IsThreadLocal);
940 GV->setVisibility(Visibility);
941 InsertValue(GV, CurModule.Values);
945 // setTypeName - Set the specified type to the name given. The name may be
946 // null potentially, in which case this is a noop. The string passed in is
947 // assumed to be a malloc'd string buffer, and is freed by this function.
949 // This function returns true if the type has already been defined, but is
950 // allowed to be redefined in the specified context. If the name is a new name
951 // for the type plane, it is inserted and false is returned.
952 static bool setTypeName(const Type *T, std::string *NameStr) {
953 assert(!inFunctionScope() && "Can't give types function-local names!");
954 if (NameStr == 0) return false;
956 std::string Name(*NameStr); // Copy string
957 delete NameStr; // Free old string
959 // We don't allow assigning names to void type
960 if (T == Type::VoidTy) {
961 GenerateError("Can't assign name '" + Name + "' to the void type");
965 // Set the type name, checking for conflicts as we do so.
966 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
968 if (AlreadyExists) { // Inserting a name that is already defined???
969 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
970 assert(Existing && "Conflict but no matching type?!");
972 // There is only one case where this is allowed: when we are refining an
973 // opaque type. In this case, Existing will be an opaque type.
974 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
975 // We ARE replacing an opaque type!
976 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
980 // Otherwise, this is an attempt to redefine a type. That's okay if
981 // the redefinition is identical to the original. This will be so if
982 // Existing and T point to the same Type object. In this one case we
983 // allow the equivalent redefinition.
984 if (Existing == T) return true; // Yes, it's equal.
986 // Any other kind of (non-equivalent) redefinition is an error.
987 GenerateError("Redefinition of type named '" + Name + "' of type '" +
988 T->getDescription() + "'");
994 //===----------------------------------------------------------------------===//
995 // Code for handling upreferences in type names...
998 // TypeContains - Returns true if Ty directly contains E in it.
1000 static bool TypeContains(const Type *Ty, const Type *E) {
1001 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1002 E) != Ty->subtype_end();
1006 struct UpRefRecord {
1007 // NestingLevel - The number of nesting levels that need to be popped before
1008 // this type is resolved.
1009 unsigned NestingLevel;
1011 // LastContainedTy - This is the type at the current binding level for the
1012 // type. Every time we reduce the nesting level, this gets updated.
1013 const Type *LastContainedTy;
1015 // UpRefTy - This is the actual opaque type that the upreference is
1016 // represented with.
1017 OpaqueType *UpRefTy;
1019 UpRefRecord(unsigned NL, OpaqueType *URTy)
1020 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1024 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1025 static std::vector<UpRefRecord> UpRefs;
1027 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1028 /// called. It loops through the UpRefs vector, which is a list of the
1029 /// currently active types. For each type, if the up reference is contained in
1030 /// the newly completed type, we decrement the level count. When the level
1031 /// count reaches zero, the upreferenced type is the type that is passed in:
1032 /// thus we can complete the cycle.
1034 static PATypeHolder HandleUpRefs(const Type *ty) {
1035 // If Ty isn't abstract, or if there are no up-references in it, then there is
1036 // nothing to resolve here.
1037 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1039 PATypeHolder Ty(ty);
1040 UR_OUT("Type '" << Ty->getDescription() <<
1041 "' newly formed. Resolving upreferences.\n" <<
1042 UpRefs.size() << " upreferences active!\n");
1044 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1045 // to zero), we resolve them all together before we resolve them to Ty. At
1046 // the end of the loop, if there is anything to resolve to Ty, it will be in
1048 OpaqueType *TypeToResolve = 0;
1050 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1051 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1052 << UpRefs[i].second->getDescription() << ") = "
1053 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1054 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1055 // Decrement level of upreference
1056 unsigned Level = --UpRefs[i].NestingLevel;
1057 UpRefs[i].LastContainedTy = Ty;
1058 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1059 if (Level == 0) { // Upreference should be resolved!
1060 if (!TypeToResolve) {
1061 TypeToResolve = UpRefs[i].UpRefTy;
1063 UR_OUT(" * Resolving upreference for "
1064 << UpRefs[i].second->getDescription() << "\n";
1065 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1066 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1067 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1068 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1070 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1071 --i; // Do not skip the next element...
1076 if (TypeToResolve) {
1077 UR_OUT(" * Resolving upreference for "
1078 << UpRefs[i].second->getDescription() << "\n";
1079 std::string OldName = TypeToResolve->getDescription());
1080 TypeToResolve->refineAbstractTypeTo(Ty);
1086 //===----------------------------------------------------------------------===//
1087 // RunVMAsmParser - Define an interface to this parser
1088 //===----------------------------------------------------------------------===//
1090 static Module* RunParser(Module * M);
1092 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1095 CurFilename = Filename;
1096 return RunParser(new Module(CurFilename));
1099 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1100 set_scan_string(AsmString);
1102 CurFilename = "from_memory";
1104 return RunParser(new Module (CurFilename));
1106 return RunParser(M);
1111 #line 967 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
1113 llvm::Module *ModuleVal;
1114 llvm::Function *FunctionVal;
1115 llvm::BasicBlock *BasicBlockVal;
1116 llvm::TerminatorInst *TermInstVal;
1117 llvm::Instruction *InstVal;
1118 llvm::Constant *ConstVal;
1120 const llvm::Type *PrimType;
1121 std::list<llvm::PATypeHolder> *TypeList;
1122 llvm::PATypeHolder *TypeVal;
1123 llvm::Value *ValueVal;
1124 std::vector<llvm::Value*> *ValueList;
1125 llvm::ArgListType *ArgList;
1126 llvm::TypeWithAttrs TypeWithAttrs;
1127 llvm::TypeWithAttrsList *TypeWithAttrsList;
1128 llvm::ValueRefList *ValueRefList;
1130 // Represent the RHS of PHI node
1131 std::list<std::pair<llvm::Value*,
1132 llvm::BasicBlock*> > *PHIList;
1133 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1134 std::vector<llvm::Constant*> *ConstVector;
1136 llvm::GlobalValue::LinkageTypes Linkage;
1137 llvm::GlobalValue::VisibilityTypes Visibility;
1138 uint16_t ParamAttrs;
1139 llvm::APInt *APIntVal;
1144 llvm::APFloat *FPVal;
1147 std::string *StrVal; // This memory must be deleted
1148 llvm::ValID ValIDVal;
1150 llvm::Instruction::BinaryOps BinaryOpVal;
1151 llvm::Instruction::TermOps TermOpVal;
1152 llvm::Instruction::MemoryOps MemOpVal;
1153 llvm::Instruction::CastOps CastOpVal;
1154 llvm::Instruction::OtherOps OtherOpVal;
1155 llvm::ICmpInst::Predicate IPredicate;
1156 llvm::FCmpInst::Predicate FPredicate;
1169 #define YYFLAG -32768
1170 #define YYNTBASE 160
1172 #define YYTRANSLATE(x) ((unsigned)(x) <= 399 ? yytranslate[x] : 241)
1174 static const short yytranslate[] = { 0,
1175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1178 2, 2, 2, 2, 2, 2, 2, 2, 2, 150,
1179 151, 148, 2, 147, 2, 2, 2, 2, 2, 2,
1180 2, 2, 2, 2, 2, 2, 2, 2, 2, 155,
1181 146, 156, 2, 2, 2, 2, 2, 2, 2, 2,
1182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184 152, 149, 154, 2, 2, 2, 2, 2, 159, 2,
1185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1186 2, 2, 2, 2, 2, 2, 2, 2, 2, 153,
1187 2, 2, 157, 2, 158, 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, 2, 2, 2, 2, 2,
1197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1200 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1201 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1202 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1203 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1204 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1205 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1206 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1207 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1208 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1209 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1210 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1211 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1212 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1213 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1214 137, 138, 139, 140, 141, 142, 143, 144, 145
1218 static const short yyprhs[] = { 0,
1219 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1220 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1221 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1222 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1223 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1224 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1225 120, 122, 124, 126, 127, 130, 131, 133, 135, 137,
1226 138, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1227 158, 160, 162, 164, 165, 167, 169, 170, 172, 174,
1228 176, 178, 179, 181, 183, 184, 186, 188, 190, 192,
1229 194, 197, 199, 201, 203, 205, 207, 209, 211, 213,
1230 215, 216, 219, 221, 223, 225, 227, 228, 231, 232,
1231 235, 236, 240, 243, 244, 246, 247, 251, 253, 256,
1232 258, 260, 262, 264, 266, 268, 270, 272, 274, 277,
1233 279, 282, 288, 294, 300, 306, 310, 313, 319, 324,
1234 327, 329, 331, 333, 337, 339, 343, 345, 346, 348,
1235 352, 357, 361, 365, 370, 375, 379, 386, 392, 395,
1236 398, 401, 404, 407, 410, 413, 416, 419, 422, 425,
1237 428, 435, 441, 450, 457, 464, 472, 480, 487, 496,
1238 505, 509, 511, 513, 515, 517, 518, 521, 528, 530,
1239 531, 533, 536, 537, 541, 542, 546, 550, 554, 558,
1240 559, 567, 568, 577, 578, 587, 593, 596, 600, 602,
1241 606, 610, 614, 618, 620, 621, 627, 631, 633, 637,
1242 639, 640, 650, 652, 654, 659, 661, 663, 666, 670,
1243 671, 673, 675, 677, 679, 681, 683, 685, 687, 689,
1244 693, 695, 701, 703, 705, 707, 709, 711, 713, 716,
1245 719, 722, 726, 729, 730, 732, 735, 738, 742, 752,
1246 762, 771, 786, 788, 790, 797, 803, 806, 813, 821,
1247 825, 831, 832, 833, 837, 840, 842, 848, 854, 861,
1248 868, 873, 880, 885, 890, 897, 904, 907, 916, 918,
1249 920, 921, 925, 932, 936, 943, 946, 952, 960
1252 static const short yyrhs[] = { 73,
1253 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1254 0, 79, 0, 80, 0, 81, 0, 85, 0, 86,
1255 0, 87, 0, 82, 0, 83, 0, 84, 0, 116,
1256 0, 117, 0, 118, 0, 119, 0, 120, 0, 121,
1257 0, 122, 0, 123, 0, 124, 0, 125, 0, 126,
1258 0, 127, 0, 90, 0, 91, 0, 92, 0, 93,
1259 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
1260 0, 99, 0, 100, 0, 101, 0, 102, 0, 103,
1261 0, 104, 0, 105, 0, 106, 0, 107, 0, 108,
1262 0, 109, 0, 96, 0, 97, 0, 98, 0, 99,
1263 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1264 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1265 0, 24, 0, 167, 0, 0, 167, 146, 0, 0,
1266 20, 0, 23, 0, 172, 0, 0, 170, 146, 0,
1267 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1268 46, 0, 48, 0, 50, 0, 0, 143, 0, 144,
1269 0, 145, 0, 0, 46, 0, 48, 0, 0, 42,
1270 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1271 42, 0, 0, 61, 0, 62, 0, 63, 0, 64,
1272 0, 65, 0, 60, 4, 0, 135, 0, 117, 0,
1273 134, 0, 118, 0, 137, 0, 138, 0, 140, 0,
1274 141, 0, 142, 0, 0, 181, 180, 0, 136, 0,
1275 139, 0, 135, 0, 134, 0, 0, 183, 182, 0,
1276 0, 53, 4, 0, 0, 147, 53, 4, 0, 34,
1277 22, 0, 0, 186, 0, 0, 147, 189, 188, 0,
1278 186, 0, 53, 4, 0, 11, 0, 12, 0, 13,
1279 0, 16, 0, 15, 0, 14, 0, 17, 0, 49,
1280 0, 190, 0, 191, 148, 0, 225, 0, 149, 4,
1281 0, 191, 150, 195, 151, 183, 0, 10, 150, 195,
1282 151, 183, 0, 152, 4, 153, 191, 154, 0, 155,
1283 4, 153, 191, 156, 0, 157, 196, 158, 0, 157,
1284 158, 0, 155, 157, 196, 158, 156, 0, 155, 157,
1285 158, 156, 0, 191, 181, 0, 191, 0, 10, 0,
1286 192, 0, 194, 147, 192, 0, 194, 0, 194, 147,
1287 39, 0, 39, 0, 0, 191, 0, 196, 147, 191,
1288 0, 191, 152, 199, 154, 0, 191, 152, 154, 0,
1289 191, 159, 22, 0, 191, 155, 199, 156, 0, 191,
1290 157, 199, 158, 0, 191, 157, 158, 0, 191, 155,
1291 157, 199, 158, 156, 0, 191, 155, 157, 158, 156,
1292 0, 191, 40, 0, 191, 41, 0, 191, 225, 0,
1293 191, 198, 0, 191, 25, 0, 165, 3, 0, 165,
1294 5, 0, 165, 4, 0, 165, 6, 0, 11, 26,
1295 0, 11, 27, 0, 166, 9, 0, 162, 150, 197,
1296 38, 191, 151, 0, 115, 150, 197, 236, 151, 0,
1297 129, 150, 197, 147, 197, 147, 197, 151, 0, 160,
1298 150, 197, 147, 197, 151, 0, 161, 150, 197, 147,
1299 197, 151, 0, 88, 163, 150, 197, 147, 197, 151,
1300 0, 89, 164, 150, 197, 147, 197, 151, 0, 131,
1301 150, 197, 147, 197, 151, 0, 132, 150, 197, 147,
1302 197, 147, 197, 151, 0, 133, 150, 197, 147, 197,
1303 147, 197, 151, 0, 199, 147, 197, 0, 197, 0,
1304 32, 0, 33, 0, 37, 0, 0, 193, 225, 0,
1305 121, 150, 202, 38, 191, 151, 0, 204, 0, 0,
1306 205, 0, 204, 205, 0, 0, 31, 206, 221, 0,
1307 0, 30, 207, 222, 0, 58, 57, 211, 0, 169,
1308 18, 191, 0, 169, 18, 10, 0, 0, 171, 175,
1309 201, 200, 197, 208, 188, 0, 0, 171, 173, 175,
1310 201, 200, 197, 209, 188, 0, 0, 171, 174, 175,
1311 201, 200, 191, 210, 188, 0, 171, 175, 35, 178,
1312 202, 0, 51, 212, 0, 54, 146, 213, 0, 22,
1313 0, 52, 146, 22, 0, 66, 146, 22, 0, 152,
1314 214, 154, 0, 214, 147, 22, 0, 22, 0, 0,
1315 215, 147, 191, 181, 168, 0, 191, 181, 168, 0,
1316 215, 0, 215, 147, 39, 0, 39, 0, 0, 179,
1317 193, 170, 150, 216, 151, 183, 187, 184, 0, 28,
1318 0, 157, 0, 177, 175, 217, 218, 0, 29, 0,
1319 158, 0, 228, 220, 0, 176, 175, 217, 0, 0,
1320 59, 0, 3, 0, 4, 0, 9, 0, 26, 0,
1321 27, 0, 40, 0, 41, 0, 25, 0, 155, 199,
1322 156, 0, 198, 0, 57, 223, 22, 147, 22, 0,
1323 7, 0, 8, 0, 167, 0, 170, 0, 225, 0,
1324 224, 0, 191, 226, 0, 228, 229, 0, 219, 229,
1325 0, 230, 169, 231, 0, 230, 233, 0, 0, 21,
1326 0, 67, 227, 0, 67, 10, 0, 68, 17, 226,
1327 0, 68, 11, 226, 147, 17, 226, 147, 17, 226,
1328 0, 69, 165, 226, 147, 17, 226, 152, 232, 154,
1329 0, 69, 165, 226, 147, 17, 226, 152, 154, 0,
1330 70, 179, 193, 226, 150, 235, 151, 183, 38, 17,
1331 226, 71, 17, 226, 0, 71, 0, 72, 0, 232,
1332 165, 224, 147, 17, 226, 0, 165, 224, 147, 17,
1333 226, 0, 169, 238, 0, 191, 152, 226, 147, 226,
1334 154, 0, 234, 147, 152, 226, 147, 226, 154, 0,
1335 191, 226, 181, 0, 235, 147, 191, 226, 181, 0,
1336 0, 0, 236, 147, 227, 0, 56, 55, 0, 55,
1337 0, 160, 191, 226, 147, 226, 0, 161, 191, 226,
1338 147, 226, 0, 88, 163, 191, 226, 147, 226, 0,
1339 89, 164, 191, 226, 147, 226, 0, 162, 227, 38,
1340 191, 0, 129, 227, 147, 227, 147, 227, 0, 130,
1341 227, 147, 191, 0, 131, 227, 147, 227, 0, 132,
1342 227, 147, 227, 147, 227, 0, 133, 227, 147, 227,
1343 147, 227, 0, 128, 234, 0, 237, 179, 193, 226,
1344 150, 235, 151, 183, 0, 240, 0, 36, 0, 0,
1345 110, 191, 185, 0, 110, 191, 147, 11, 226, 185,
1346 0, 111, 191, 185, 0, 111, 191, 147, 11, 226,
1347 185, 0, 112, 227, 0, 239, 113, 191, 226, 185,
1348 0, 239, 114, 227, 147, 191, 226, 185, 0, 115,
1355 static const short yyrline[] = { 0,
1356 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1127,
1357 1127, 1127, 1127, 1127, 1127, 1128, 1128, 1128, 1128, 1128,
1358 1128, 1128, 1129, 1129, 1129, 1129, 1129, 1132, 1132, 1133,
1359 1133, 1134, 1134, 1135, 1135, 1136, 1136, 1140, 1140, 1141,
1360 1141, 1142, 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146,
1361 1146, 1147, 1148, 1153, 1154, 1154, 1154, 1154, 1154, 1156,
1362 1156, 1156, 1157, 1157, 1161, 1165, 1170, 1170, 1172, 1173,
1363 1178, 1184, 1185, 1186, 1187, 1188, 1192, 1193, 1194, 1198,
1364 1199, 1200, 1201, 1205, 1206, 1207, 1211, 1212, 1213, 1214,
1365 1215, 1219, 1220, 1221, 1224, 1224, 1225, 1226, 1227, 1228,
1366 1229, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245,
1367 1248, 1249, 1254, 1255, 1256, 1257, 1260, 1261, 1268, 1268,
1368 1275, 1275, 1284, 1292, 1292, 1298, 1298, 1300, 1305, 1318,
1369 1318, 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336,
1370 1341, 1349, 1379, 1410, 1415, 1427, 1437, 1441, 1451, 1458,
1371 1465, 1472, 1477, 1482, 1489, 1490, 1497, 1504, 1512, 1518,
1372 1530, 1558, 1574, 1601, 1629, 1655, 1675, 1701, 1721, 1733,
1373 1740, 1806, 1816, 1826, 1832, 1842, 1848, 1858, 1863, 1868,
1374 1881, 1893, 1915, 1923, 1929, 1940, 1945, 1950, 1956, 1962,
1375 1971, 1975, 1983, 1983, 1986, 1986, 1989, 2001, 2022, 2027,
1376 2035, 2036, 2040, 2040, 2044, 2044, 2047, 2050, 2074, 2085,
1377 2092, 2095, 2101, 2104, 2111, 2115, 2155, 2158, 2164, 2174,
1378 2178, 2183, 2185, 2190, 2195, 2204, 2214, 2225, 2229, 2238,
1379 2247, 2252, 2373, 2373, 2375, 2384, 2384, 2386, 2391, 2403,
1380 2407, 2412, 2416, 2420, 2424, 2428, 2432, 2436, 2440, 2444,
1381 2469, 2473, 2483, 2487, 2491, 2496, 2503, 2503, 2509, 2518,
1382 2522, 2531, 2540, 2549, 2553, 2560, 2564, 2568, 2573, 2583,
1383 2602, 2611, 2691, 2695, 2702, 2713, 2726, 2736, 2747, 2757,
1384 2766, 2775, 2778, 2779, 2786, 2790, 2795, 2816, 2833, 2847,
1385 2861, 2873, 2881, 2888, 2894, 2900, 2906, 2921, 3006, 3011,
1386 3015, 3022, 3029, 3037, 3044, 3052, 3060, 3074, 3091
1391 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1393 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1394 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1395 "VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1396 "LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1397 "ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1398 "GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1399 "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1400 "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL",
1401 "TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1402 "X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE",
1403 "UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM",
1404 "FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT",
1405 "SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD",
1406 "UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC",
1407 "ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI",
1408 "INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT",
1409 "SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET","NOUNWIND","NOALIAS",
1410 "BYVAL","NEST","DEFAULT","HIDDEN","PROTECTED","'='","','","'*'","'\\\\'","'('",
1411 "')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps",
1412 "CastOps","IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName",
1413 "OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage",
1414 "GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage",
1415 "AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs",
1416 "OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1417 "PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1418 "ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1419 "Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1420 "LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1421 "FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1422 "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1423 "BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","IndexList","OptTailCall",
1424 "InstVal","OptVolatile","MemoryInst", NULL
1428 static const short yyr1[] = { 0,
1429 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1430 161, 161, 161, 161, 161, 162, 162, 162, 162, 162,
1431 162, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1432 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
1433 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1434 164, 164, 164, 165, 166, 166, 166, 166, 166, 167,
1435 167, 167, 168, 168, 169, 169, 170, 170, 171, 171,
1436 172, 173, 173, 173, 173, 173, 174, 174, 174, 175,
1437 175, 175, 175, 176, 176, 176, 177, 177, 177, 177,
1438 177, 178, 178, 178, 179, 179, 179, 179, 179, 179,
1439 179, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1440 181, 181, 182, 182, 182, 182, 183, 183, 184, 184,
1441 185, 185, 186, 187, 187, 188, 188, 189, 189, 190,
1442 190, 190, 190, 190, 190, 190, 191, 191, 191, 191,
1443 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1444 193, 193, 194, 194, 195, 195, 195, 195, 196, 196,
1445 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1446 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1447 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1448 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1449 204, 204, 206, 205, 207, 205, 205, 205, 205, 208,
1450 205, 209, 205, 210, 205, 205, 205, 205, 211, 212,
1451 212, 213, 214, 214, 214, 215, 215, 216, 216, 216,
1452 216, 217, 218, 218, 219, 220, 220, 221, 222, 223,
1453 223, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1454 224, 224, 225, 225, 225, 225, 226, 226, 227, 228,
1455 228, 229, 230, 230, 230, 231, 231, 231, 231, 231,
1456 231, 231, 231, 231, 232, 232, 233, 234, 234, 235,
1457 235, 235, 236, 236, 237, 237, 238, 238, 238, 238,
1458 238, 238, 238, 238, 238, 238, 238, 238, 238, 239,
1459 239, 240, 240, 240, 240, 240, 240, 240, 240
1462 static const short yyr2[] = { 0,
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, 1, 1, 1, 1, 1, 1, 1,
1466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1469 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1470 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1471 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1472 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1473 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1474 0, 2, 1, 1, 1, 1, 0, 2, 0, 2,
1475 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
1476 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1477 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1478 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1479 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1481 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1482 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1483 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1484 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1485 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1486 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1487 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1488 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1489 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1490 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1491 5, 0, 0, 3, 2, 1, 5, 5, 6, 6,
1492 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
1493 0, 3, 6, 3, 6, 2, 5, 7, 4
1496 static const short yydefact[] = { 70,
1497 60, 67, 61, 68, 62, 205, 203, 0, 0, 0,
1498 0, 0, 0, 80, 69, 70, 201, 84, 87, 0,
1499 0, 217, 0, 0, 65, 0, 71, 72, 74, 73,
1500 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1501 196, 202, 85, 86, 80, 206, 88, 89, 90, 91,
1502 80, 264, 204, 264, 0, 0, 225, 218, 219, 207,
1503 253, 254, 209, 130, 131, 132, 135, 134, 133, 136,
1504 137, 0, 0, 0, 0, 255, 256, 138, 208, 140,
1505 196, 196, 92, 195, 0, 95, 95, 265, 261, 66,
1506 236, 237, 238, 260, 220, 221, 224, 0, 158, 141,
1507 0, 0, 0, 0, 147, 159, 0, 139, 158, 0,
1508 0, 94, 93, 0, 193, 194, 0, 0, 96, 97,
1509 98, 99, 100, 0, 239, 0, 301, 263, 0, 222,
1510 157, 111, 153, 155, 0, 0, 0, 0, 0, 0,
1511 146, 0, 0, 0, 152, 0, 151, 0, 216, 130,
1512 131, 132, 135, 134, 133, 0, 0, 0, 210, 101,
1513 0, 233, 234, 235, 300, 286, 0, 0, 0, 0,
1514 95, 273, 274, 1, 2, 3, 4, 5, 6, 7,
1515 8, 9, 13, 14, 15, 10, 11, 12, 0, 0,
1516 0, 0, 0, 0, 16, 17, 18, 19, 20, 21,
1517 22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
1518 0, 0, 0, 0, 0, 262, 95, 277, 0, 299,
1519 223, 150, 0, 117, 0, 0, 149, 0, 160, 117,
1520 212, 214, 0, 197, 178, 179, 174, 176, 175, 177,
1521 180, 173, 169, 170, 0, 0, 0, 0, 0, 0,
1522 0, 0, 0, 0, 0, 0, 0, 0, 172, 171,
1523 126, 0, 285, 267, 0, 266, 0, 0, 54, 0,
1524 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1525 37, 0, 52, 53, 48, 49, 50, 51, 38, 39,
1526 40, 41, 42, 43, 44, 45, 46, 47, 0, 121,
1527 121, 306, 0, 0, 297, 0, 0, 0, 0, 0,
1528 0, 0, 0, 0, 0, 0, 103, 105, 104, 102,
1529 106, 107, 108, 109, 110, 112, 156, 154, 143, 144,
1530 145, 148, 142, 126, 126, 0, 0, 0, 0, 0,
1531 0, 0, 0, 162, 192, 0, 0, 0, 166, 0,
1532 163, 0, 0, 0, 0, 211, 231, 242, 243, 244,
1533 249, 245, 246, 247, 248, 240, 0, 251, 258, 257,
1534 259, 0, 268, 0, 0, 0, 0, 0, 302, 0,
1535 304, 283, 0, 0, 0, 0, 0, 0, 0, 0,
1536 0, 0, 0, 0, 0, 116, 115, 113, 114, 118,
1537 213, 215, 0, 0, 0, 283, 0, 0, 0, 0,
1538 0, 161, 147, 159, 0, 164, 165, 0, 0, 0,
1539 0, 0, 128, 126, 230, 111, 228, 0, 241, 0,
1540 0, 0, 0, 0, 0, 0, 0, 0, 0, 309,
1541 0, 0, 0, 293, 294, 0, 0, 0, 0, 291,
1542 0, 121, 0, 0, 0, 0, 0, 0, 0, 0,
1543 0, 191, 168, 0, 0, 0, 0, 123, 129, 127,
1544 64, 0, 117, 0, 250, 0, 0, 282, 0, 0,
1545 121, 122, 121, 0, 0, 0, 0, 0, 0, 287,
1546 288, 282, 0, 307, 0, 198, 0, 0, 182, 0,
1547 0, 0, 0, 167, 0, 0, 0, 63, 227, 229,
1548 111, 124, 0, 0, 0, 0, 0, 289, 290, 303,
1549 305, 284, 0, 0, 292, 295, 296, 0, 121, 0,
1550 0, 0, 188, 0, 0, 184, 185, 181, 64, 125,
1551 119, 252, 0, 0, 111, 0, 117, 278, 0, 117,
1552 308, 186, 187, 0, 0, 0, 226, 0, 232, 0,
1553 271, 0, 0, 280, 0, 0, 279, 298, 183, 189,
1554 190, 120, 269, 0, 270, 0, 111, 0, 0, 0,
1555 281, 0, 0, 0, 0, 276, 0, 0, 275, 0,
1559 static const short yydefgoto[] = { 256,
1560 257, 258, 282, 299, 156, 157, 76, 509, 12, 77,
1561 14, 15, 39, 40, 41, 45, 51, 114, 124, 326,
1562 222, 400, 329, 559, 379, 423, 541, 356, 424, 78,
1563 158, 133, 148, 134, 135, 107, 345, 368, 346, 117,
1564 85, 149, 592, 16, 17, 19, 18, 261, 334, 335,
1565 60, 22, 58, 98, 427, 428, 125, 164, 52, 93,
1566 53, 46, 430, 369, 80, 371, 266, 54, 89, 90,
1567 216, 563, 128, 305, 517, 440, 217, 218, 219, 220
1570 static const short yypact[] = { 42,
1571 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -21, -131, 60,
1572 -93, 105, -22, 182,-32768, 525,-32768, 46, 168, -12,
1573 19,-32768, 1, 152,-32768, 1277,-32768,-32768,-32768,-32768,
1574 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 90, 90,
1575 100,-32768,-32768,-32768, 90,-32768,-32768,-32768,-32768,-32768,
1576 90, 186,-32768, 12, 187, 201, 209,-32768,-32768,-32768,
1577 -32768,-32768, 93,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1578 -32768, 252, 254, 2, 907,-32768,-32768,-32768, 13,-32768,
1579 225, 225, 150,-32768, 76, 116, 116,-32768,-32768, 108,
1580 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -79, 1027,-32768,
1581 111, 114, 947, 93,-32768, 13, -104,-32768, 1027, 76,
1582 76,-32768,-32768, 1067,-32768,-32768, 1299, 266,-32768,-32768,
1583 -32768,-32768,-32768, 1330,-32768, -16, 1572,-32768, 256,-32768,
1584 -32768, 13,-32768, 139, 144, 1370, 1370, 132, -95, 1370,
1585 -32768, 145, 1299, 1370, 93, 147, 13, 311,-32768, 43,
1586 290, 293, 298, 299, 302, 247, 303, 724,-32768,-32768,
1587 35,-32768,-32768,-32768,-32768,-32768, 258, 1450, 70, 305,
1588 116,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1589 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 317, 405,
1590 1370, 1370, 1370, 1370,-32768,-32768,-32768,-32768,-32768,-32768,
1591 -32768,-32768,-32768,-32768,-32768,-32768, 1370, 1370, 1370, 1370,
1592 1370, 1370, 1370, 1370, 1370,-32768, 116,-32768, 34,-32768,
1593 -32768, 131, 1107,-32768, 6, -46,-32768, 164, 13,-32768,
1594 -32768, 13, 1067,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1595 -32768,-32768,-32768,-32768, 317, 405, 173, 178, 179, 189,
1596 192, 1179, 1481, 987, 314, 193, 197, 198,-32768,-32768,
1597 202, 203,-32768, 93, 565,-32768, 699, 699,-32768, 699,
1598 1330,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1599 -32768, 1370,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1600 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1370, 113,
1601 137,-32768, 565, -10, 205, 207, 208, 210, 218, 219,
1602 565, 565, 330, 1330, 1370, 1370,-32768,-32768,-32768,-32768,
1603 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 106,-32768,
1604 -32768,-32768, 106, 202, 202, 331, 220, 221, 1299, 1299,
1605 1299, 1299, 1299,-32768,-32768, -41, 1005, -61,-32768, -91,
1606 -32768, 1299, 1299, 1299, -13,-32768, 1219,-32768,-32768,-32768,
1607 -32768,-32768,-32768,-32768,-32768, 313, 1299,-32768,-32768,-32768,
1608 -32768, 226,-32768, 227, 699, 565, 565, 23,-32768, 24,
1609 -32768,-32768, 699, 223, 1370, 1370, 1370, 1370, 1370, 232,
1610 233, 1370, 699, 565, 234,-32768,-32768,-32768,-32768,-32768,
1611 -32768,-32768, 1370, 1299, 1299,-32768, 235, 236, 237, 239,
1612 1299,-32768, 231, 724, -76,-32768,-32768, 241, 242, 352,
1613 369, 388,-32768, 202,-32768, 13, 246, 243,-32768, 374,
1614 -59, 380, 385, 253, 257, 270, 699, 414, 699, 272,
1615 273, 699, 278, 13,-32768, 280, 282, 699, 699, 13,
1616 283, 287, 1370, -112, 288, 289, -33, 1299, 1299, 1299,
1617 1299,-32768,-32768, 294, 1299, 1299, 1370,-32768,-32768,-32768,
1618 79, 1259,-32768, 292,-32768, 699, 699, 1370, 699, 699,
1619 287,-32768, 287, 1370, 699, 307, 1370, 1370, 1370,-32768,
1620 -32768, 1370, 392,-32768, 565,-32768, 1299, 1299,-32768, 308,
1621 295, 309, 310,-32768, 301, 315, 7,-32768,-32768,-32768,
1622 13, 10, 427, 318, 306, 565, 52,-32768,-32768,-32768,
1623 -32768,-32768, 316, 699,-32768,-32768,-32768, 71, 287, 322,
1624 325, 1299,-32768, 1299, 1299,-32768,-32768,-32768, 79,-32768,
1625 407,-32768, 444, -4,-32768, 1370,-32768,-32768, 323,-32768,
1626 -32768,-32768,-32768, 327, 328, 329,-32768, 464,-32768, 699,
1627 -32768, 859, -3, 131, 565, -14,-32768, 106,-32768,-32768,
1628 -32768,-32768,-32768, 334,-32768, 859,-32768, 452, 465, 336,
1629 131, 699, 699, 468, 416,-32768, 699, 471,-32768, 699,
1630 -32768, 490, 491,-32768
1633 static const short yypgoto[] = { 365,
1634 366, 367, 255, 251, -168,-32768, 0, -40, 408, 14,
1635 -32768,-32768,-32768,-32768, 40,-32768,-32768,-32768, -158,-32768,
1636 -406,-32768, -226,-32768, -290, 3,-32768, -317,-32768,-32768,
1637 -25, 296, -119,-32768, 409, 413, -60, -155, -231, 166,
1638 119, 284,-32768,-32768, 504,-32768,-32768,-32768,-32768,-32768,
1639 -32768,-32768,-32768,-32768,-32768,-32768, 435,-32768,-32768,-32768,
1640 -32768,-32768,-32768, -525, -139, 47, -183,-32768, 474,-32768,
1641 -32768,-32768,-32768,-32768, 37, 124,-32768,-32768,-32768,-32768
1648 static const short yytable[] = { 11,
1649 79, 270, 259, 333, 161, 102, 269, 269, 234, 302,
1650 381, 162, 271, 13, 23, 11, 401, 402, 260, 471,
1651 421, 348, 350, 578, 306, 307, 308, 309, 310, 13,
1652 20, 313, 88, 437, 439, 108, 574, 109, 496, 422,
1653 91, -200, 140, 421, 21, -54, -54, -54, -54, 106,
1654 580, 140, 25, 141, 2, 411, 159, 4, 314, -66,
1655 1, 2, 228, 3, 4, 5, 417, 129, 235, 236,
1656 411, 6, 7, 132, 130, 438, 438, 106, 81, 82,
1657 267, 464, 231, 132, 86, 411, 268, 411, 147, 11,
1658 87, 43, 8, 44, 416, 9, 475, 1, 147, 10,
1659 3, 108, 5, 109, 539, 411, 470, 115, 116, 331,
1660 225, 226, 412, 484, 229, 415, 24, 499, 232, 396,
1661 397, 398, 26, 27, 399, 370, 1, 370, 370, 3,
1662 370, 5, 395, 55, 83, 431, 84, 108, 564, 109,
1663 163, 383, 265, 396, 397, 398, 315, 316, 399, 561,
1664 575, 375, 57, 108, 108, 109, 109, 538, 103, 330,
1665 108, 494, 109, 370, 56, 300, 301, 265, 303, 92,
1666 581, 370, 370, 59, 262, 118, 119, 120, 121, 122,
1667 123, 304, 265, 265, 265, 265, 265, 311, 312, 265,
1668 520, 112, 521, 113, 393, 317, 318, 132, 546, 110,
1669 111, 443, 547, 445, 446, 447, 88, 147, 95, 47,
1670 48, 49, 319, 320, 50, 321, 322, 546, 323, 324,
1671 325, 550, 96, 28, 29, 30, 31, 32, 33, 34,
1672 97, 35, 36, 37, 38, 370, 370, 370, 551, 396,
1673 397, 398, 99, 370, 399, 147, 512, 317, 318, 237,
1674 238, 239, 240, 370, 370, 100, 376, 101, 259, 378,
1675 108, 84, 109, 136, 319, 320, 137, 321, 322, 160,
1676 323, 324, 325, 377, 260, 143, 144, 221, 406, 407,
1677 408, 409, 410, 380, 108, 223, 109, 227, 147, 394,
1678 265, 418, 419, 420, 224, 230, 233, 370, -55, 370,
1679 522, -56, 370, 525, 526, 527, -59, -58, 370, 370,
1680 -57, 241, 263, 372, 373, 269, 374, 61, 62, 332,
1681 566, 414, 339, 568, 36, 37, 38, 340, 341, 1,
1682 2, 426, 3, 4, 5, 351, 370, 370, 342, 370,
1683 370, 343, 352, 455, 456, 370, 353, 354, 355, 382,
1684 462, 384, 357, 385, 386, 370, 387, 390, 391, 265,
1685 444, 265, 265, 265, 388, 389, 450, 392, 403, 404,
1686 405, 429, 432, 433, 442, 562, 370, 454, 448, 449,
1687 453, 458, 459, 460, 370, 461, 463, 465, 466, 467,
1688 468, 469, 472, 473, 576, 474, 476, 500, 501, 502,
1689 503, 477, 478, 479, 505, 506, 272, 273, 274, 275,
1690 276, 277, 278, 279, 280, 281, 480, 482, 484, 485,
1691 370, 434, 435, 436, 487, 370, 488, 495, 489, 441,
1692 283, 284, 492, 493, 497, 498, 530, 531, 513, 451,
1693 452, 507, 370, 370, 438, 533, 511, 370, 542, 504,
1694 370, 536, 516, 524, 532, 534, 535, 544, 265, 558,
1695 560, 265, 265, 265, 543, 537, 516, 572, 582, 548,
1696 508, 554, 552, 555, 556, 553, 567, 569, 570, 571,
1697 579, 583, 584, 481, 587, 483, 588, 590, 486, 593,
1698 594, 213, 214, 215, 490, 491, 338, 127, 557, 337,
1699 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1700 295, 296, 297, 298, 540, 139, 336, 142, 328, 42,
1701 565, 126, 514, 515, -199, 518, 519, 94, 528, 457,
1702 0, 523, 0, 0, 0, 0, 0, 0, 508, 0,
1703 0, 529, -66, 1, 2, 0, 3, 4, 5, 0,
1704 0, 0, 0, 0, 6, 7, 0, 0, 0, 0,
1705 0, 0, 545, 0, 0, 0, 0, 358, 359, 0,
1706 549, 61, 62, 360, 0, 8, 0, 0, 9, 0,
1707 0, 0, 10, 1, 2, 0, 3, 4, 5, 361,
1708 362, 363, 0, 0, 0, 0, 0, 0, 0, 0,
1709 0, 0, 0, 0, 364, 365, 573, 0, 0, 0,
1710 0, 577, 0, 0, 0, 0, 0, 0, 0, 0,
1711 0, 366, 0, 0, 0, 0, 0, 0, 585, 586,
1712 0, 0, 0, 589, 0, 0, 591, 174, 175, 176,
1713 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1714 187, 188, 245, 246, 0, 0, 0, 0, 0, 0,
1715 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1716 0, 0, 0, 0, 0, 0, 0, 0, 0, 247,
1717 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1718 205, 206, 0, 248, 0, 249, 250, 251, 0, 0,
1719 0, 358, 359, 0, 0, 61, 62, 360, 0, 0,
1720 0, 0, 108, 0, 109, 0, 0, 1, 2, 367,
1721 3, 4, 5, 361, 362, 363, 0, 0, 0, 0,
1722 61, 62, 0, 0, 0, 0, 0, 0, 364, 365,
1723 0, 0, 1, 2, 0, 3, 4, 5, 242, 0,
1724 0, 0, 0, 0, 0, 366, 0, 0, 0, 0,
1725 0, 0, 0, 243, 244, 0, 0, 0, 0, 0,
1726 0, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1727 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1728 0, 0, 0, 0, 0, 0, 174, 175, 176, 177,
1729 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1730 188, 245, 246, 247, 195, 196, 197, 198, 199, 200,
1731 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1732 250, 251, 0, 0, 0, 0, 0, 0, 247, 195,
1733 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
1734 206, 0, 248, 367, 249, 250, 251, 0, 0, 0,
1735 0, 358, 359, 0, 0, 0, 0, 360, 0, 0,
1736 0, 108, 0, 109, 0, 252, 0, 0, 253, 0,
1737 254, 0, 255, 361, 362, 363, 0, 0, 0, 0,
1738 0, 0, 0, 0, 0, 0, 0, 0, 364, 365,
1739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1740 0, 0, 0, 61, 62, 366, 104, 64, 65, 66,
1741 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1742 5, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1743 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1744 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1745 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1746 5, 0, 0, 247, 195, 196, 197, 198, 199, 200,
1747 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1748 250, 251, 0, 61, 62, 71, 104, 150, 151, 152,
1749 153, 154, 155, 70, 0, 1, 2, 0, 3, 4,
1750 5, 61, 62, 367, 104, 150, 151, 152, 153, 154,
1751 155, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1752 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1753 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1754 5, 0, 0, 71, 0, 72, 0, 0, 73, 0,
1755 0, 74, 0, 75, 105, 131, 0, 0, 0, 0,
1756 0, 0, 0, 61, 62, 71, 145, 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, 138, 0, 0, 0, 0, 0,
1760 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1761 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1762 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1763 0, 74, 0, 75, 349, 327, 0, 0, 0, 0,
1764 0, 0, 0, 72, 0, 71, 73, 0, 0, 74,
1765 0, 75, 413, 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, 146, 104, 150,
1768 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1769 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1770 0, 0, 0, 0, 0, 72, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0,
1774 0, 0, 0, 0, 0, 72, 0, 425, 73, 0,
1775 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1776 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1777 3, 4, 5, 61, 62, 0, 63, 64, 65, 66,
1778 67, 68, 69, 70, 0, 1, 2, 510, 3, 4,
1779 5, 0, 0, 0, 0, 61, 62, 71, 104, 150,
1780 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1781 3, 4, 5, 0, 0, 71, 0, 72, 0, 0,
1782 73, 0, 344, 74, 0, 75, 61, 62, 0, 145,
1783 64, 65, 66, 67, 68, 69, 70, 71, 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, 61, 62, 71, 104,
1787 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1788 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1789 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1790 73, 0, 0, 74, 0, 75, 0, 0, 71, 0,
1791 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1792 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
1793 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1794 73, 0, 0, 74, 0, 75, 61, 62, 0, 264,
1795 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1796 0, 3, 4, 5, 0, 0, 0, 0, 72, 0,
1797 0, 73, 0, 0, 74, 0, 75, 61, 62, 0,
1798 104, 150, 151, 152, 153, 154, 155, 70, 71, 1,
1799 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
1800 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1801 0, 73, 0, 0, 74, 0, 75, 0, 0, 71,
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, 0, 0,
1805 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1807 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1808 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1809 0, 73, 0, 0, 74, 0, 75, 165, 0, 0,
1810 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1811 0, 0, 0, 0, 0, 0, 166, 167, 0, 72,
1812 0, 0, 73, 0, 0, 74, 0, 347, 168, 169,
1813 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
1814 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1815 190, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1816 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1817 0, 191, 192, 193, 0, 0, 194, 195, 196, 197,
1818 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1819 208, 209, 210, 211, 212
1822 static const short yycheck[] = { 0,
1823 26, 170, 158, 230, 124, 4, 11, 11, 148, 193,
1824 301, 28, 171, 0, 146, 16, 334, 335, 158, 426,
1825 34, 253, 254, 38, 208, 209, 210, 211, 212, 16,
1826 52, 215, 21, 11, 11, 148, 562, 150, 151, 53,
1827 29, 0, 147, 34, 66, 3, 4, 5, 6, 75,
1828 576, 147, 146, 158, 20, 147, 117, 23, 217, 18,
1829 19, 20, 158, 22, 23, 24, 158, 147, 26, 27,
1830 147, 30, 31, 99, 154, 53, 53, 103, 39, 40,
1831 11, 158, 143, 109, 45, 147, 17, 147, 114, 90,
1832 51, 46, 51, 48, 156, 54, 156, 19, 124, 58,
1833 22, 148, 24, 150, 511, 147, 424, 32, 33, 156,
1834 136, 137, 154, 147, 140, 347, 57, 151, 144, 134,
1835 135, 136, 18, 146, 139, 265, 19, 267, 268, 22,
1836 270, 24, 316, 146, 35, 367, 37, 148, 545, 150,
1837 157, 152, 168, 134, 135, 136, 113, 114, 139, 154,
1838 154, 271, 152, 148, 148, 150, 150, 151, 157, 154,
1839 148, 452, 150, 303, 146, 191, 192, 193, 194, 158,
1840 577, 311, 312, 22, 161, 60, 61, 62, 63, 64,
1841 65, 207, 208, 209, 210, 211, 212, 213, 214, 215,
1842 481, 42, 483, 44, 314, 117, 118, 223, 147, 81,
1843 82, 385, 151, 387, 388, 389, 21, 233, 22, 42,
1844 43, 44, 134, 135, 47, 137, 138, 147, 140, 141,
1845 142, 151, 22, 42, 43, 44, 45, 46, 47, 48,
1846 22, 50, 143, 144, 145, 375, 376, 377, 529, 134,
1847 135, 136, 150, 383, 139, 271, 473, 117, 118, 3,
1848 4, 5, 6, 393, 394, 4, 282, 4, 414, 147,
1849 148, 37, 150, 153, 134, 135, 153, 137, 138, 4,
1850 140, 141, 142, 299, 414, 110, 111, 22, 339, 340,
1851 341, 342, 343, 147, 148, 147, 150, 156, 314, 315,
1852 316, 352, 353, 354, 151, 151, 150, 437, 9, 439,
1853 484, 9, 442, 487, 488, 489, 9, 9, 448, 449,
1854 9, 9, 55, 267, 268, 11, 270, 7, 8, 156,
1855 547, 347, 150, 550, 143, 144, 145, 150, 150, 19,
1856 20, 357, 22, 23, 24, 22, 476, 477, 150, 479,
1857 480, 150, 150, 404, 405, 485, 150, 150, 147, 303,
1858 411, 147, 150, 147, 147, 495, 147, 311, 312, 385,
1859 386, 387, 388, 389, 147, 147, 392, 38, 38, 150,
1860 150, 59, 147, 147, 152, 544, 516, 403, 147, 147,
1861 147, 147, 147, 147, 524, 147, 156, 147, 147, 38,
1862 22, 4, 147, 151, 563, 22, 17, 458, 459, 460,
1863 461, 17, 150, 147, 465, 466, 90, 91, 92, 93,
1864 94, 95, 96, 97, 98, 99, 147, 4, 147, 147,
1865 560, 375, 376, 377, 147, 565, 147, 453, 147, 383,
1866 26, 27, 150, 147, 147, 147, 497, 498, 147, 393,
1867 394, 467, 582, 583, 53, 151, 472, 587, 22, 156,
1868 590, 151, 478, 147, 147, 147, 147, 152, 484, 53,
1869 17, 487, 488, 489, 147, 151, 492, 4, 17, 154,
1870 471, 532, 151, 534, 535, 151, 154, 151, 151, 151,
1871 147, 17, 147, 437, 17, 439, 71, 17, 442, 0,
1872 0, 127, 127, 127, 448, 449, 246, 90, 539, 245,
1873 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1874 106, 107, 108, 109, 512, 103, 233, 109, 223, 16,
1875 546, 87, 476, 477, 0, 479, 480, 54, 492, 406,
1876 -1, 485, -1, -1, -1, -1, -1, -1, 539, -1,
1877 -1, 495, 18, 19, 20, -1, 22, 23, 24, -1,
1878 -1, -1, -1, -1, 30, 31, -1, -1, -1, -1,
1879 -1, -1, 516, -1, -1, -1, -1, 3, 4, -1,
1880 524, 7, 8, 9, -1, 51, -1, -1, 54, -1,
1881 -1, -1, 58, 19, 20, -1, 22, 23, 24, 25,
1882 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
1883 -1, -1, -1, -1, 40, 41, 560, -1, -1, -1,
1884 -1, 565, -1, -1, -1, -1, -1, -1, -1, -1,
1885 -1, 57, -1, -1, -1, -1, -1, -1, 582, 583,
1886 -1, -1, -1, 587, -1, -1, 590, 73, 74, 75,
1887 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1888 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
1889 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1890 -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
1891 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1892 126, 127, -1, 129, -1, 131, 132, 133, -1, -1,
1893 -1, 3, 4, -1, -1, 7, 8, 9, -1, -1,
1894 -1, -1, 148, -1, 150, -1, -1, 19, 20, 155,
1895 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
1896 7, 8, -1, -1, -1, -1, -1, -1, 40, 41,
1897 -1, -1, 19, 20, -1, 22, 23, 24, 25, -1,
1898 -1, -1, -1, -1, -1, 57, -1, -1, -1, -1,
1899 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
1900 -1, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1901 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1902 -1, -1, -1, -1, -1, -1, 73, 74, 75, 76,
1903 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1904 87, 88, 89, 115, 116, 117, 118, 119, 120, 121,
1905 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1906 132, 133, -1, -1, -1, -1, -1, -1, 115, 116,
1907 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1908 127, -1, 129, 155, 131, 132, 133, -1, -1, -1,
1909 -1, 3, 4, -1, -1, -1, -1, 9, -1, -1,
1910 -1, 148, -1, 150, -1, 152, -1, -1, 155, -1,
1911 157, -1, 159, 25, 26, 27, -1, -1, -1, -1,
1912 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
1913 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1914 -1, -1, -1, 7, 8, 57, 10, 11, 12, 13,
1915 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1916 24, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1917 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1918 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1919 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1920 24, -1, -1, 115, 116, 117, 118, 119, 120, 121,
1921 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1922 132, 133, -1, 7, 8, 49, 10, 11, 12, 13,
1923 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1924 24, 7, 8, 155, 10, 11, 12, 13, 14, 15,
1925 16, 17, -1, 19, 20, -1, 22, 23, 24, -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, 49, -1, 149, -1, -1, 152, -1,
1929 -1, 155, -1, 157, 158, 39, -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, -1, -1, -1, -1, -1,
1934 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1935 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1936 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1937 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1938 -1, -1, -1, 149, -1, 49, 152, -1, -1, 155,
1939 -1, 157, 158, -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, 121, 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, -1, 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, -1, -1, -1, -1, -1, -1, -1,
1948 -1, -1, -1, -1, -1, 149, -1, 39, 152, -1,
1949 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1950 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1951 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
1952 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
1953 24, -1, -1, -1, -1, 7, 8, 49, 10, 11,
1954 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1955 22, 23, 24, -1, -1, 49, -1, 149, -1, -1,
1956 152, -1, 154, 155, -1, 157, 7, 8, -1, 10,
1957 11, 12, 13, 14, 15, 16, 17, 49, 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, 7, 8, 49, 10,
1961 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1962 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1963 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1964 152, -1, -1, 155, -1, 157, -1, -1, 49, -1,
1965 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1966 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
1967 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1968 152, -1, -1, 155, -1, 157, 7, 8, -1, 10,
1969 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1970 -1, 22, 23, 24, -1, -1, -1, -1, 149, -1,
1971 -1, 152, -1, -1, 155, -1, 157, 7, 8, -1,
1972 10, 11, 12, 13, 14, 15, 16, 17, 49, 19,
1973 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
1974 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1975 -1, 152, -1, -1, 155, -1, 157, -1, -1, 49,
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, -1, -1,
1979 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1980 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1981 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1982 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1983 -1, 152, -1, -1, 155, -1, 157, 36, -1, -1,
1984 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1985 -1, -1, -1, -1, -1, -1, 55, 56, -1, 149,
1986 -1, -1, 152, -1, -1, 155, -1, 157, 67, 68,
1987 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
1988 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1989 89, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1990 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1991 -1, 110, 111, 112, -1, -1, 115, 116, 117, 118,
1992 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
1993 129, 130, 131, 132, 133
1995 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1996 #line 3 "/usr/share/bison.simple"
1997 /* This file comes from bison-1.28. */
1999 /* Skeleton output parser for bison,
2000 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2002 This program is free software; you can redistribute it and/or modify
2003 it under the terms of the GNU General Public License as published by
2004 the Free Software Foundation; either version 2, or (at your option)
2007 This program is distributed in the hope that it will be useful,
2008 but WITHOUT ANY WARRANTY; without even the implied warranty of
2009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2010 GNU General Public License for more details.
2012 You should have received a copy of the GNU General Public License
2013 along with this program; if not, write to the Free Software
2014 Foundation, Inc., 59 Temple Place - Suite 330,
2015 Boston, MA 02111-1307, USA. */
2017 /* As a special exception, when this file is copied by Bison into a
2018 Bison output file, you may use that output file without restriction.
2019 This special exception was added by the Free Software Foundation
2020 in version 1.24 of Bison. */
2022 /* This is the parser code that is written into each bison parser
2023 when the %semantic_parser declaration is not specified in the grammar.
2024 It was written by Richard Stallman by simplifying the hairy parser
2025 used when %semantic_parser is specified. */
2027 #ifndef YYSTACK_USE_ALLOCA
2029 #define YYSTACK_USE_ALLOCA
2030 #else /* alloca not defined */
2032 #define YYSTACK_USE_ALLOCA
2033 #define alloca __builtin_alloca
2034 #else /* not GNU C. */
2035 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2036 #define YYSTACK_USE_ALLOCA
2038 #else /* not sparc */
2039 /* We think this test detects Watcom and Microsoft C. */
2040 /* This used to test MSDOS, but that is a bad idea
2041 since that symbol is in the user namespace. */
2042 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2043 #if 0 /* No need for malloc.h, which pollutes the namespace;
2044 instead, just don't use alloca. */
2047 #else /* not MSDOS, or __TURBOC__ */
2049 /* I don't know what this was needed for, but it pollutes the namespace.
2050 So I turned it off. rms, 2 May 1997. */
2051 /* #include <malloc.h> */
2053 #define YYSTACK_USE_ALLOCA
2054 #else /* not MSDOS, or __TURBOC__, or _AIX */
2056 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2057 and on HPUX 10. Eventually we can turn this on. */
2058 #define YYSTACK_USE_ALLOCA
2059 #define alloca __builtin_alloca
2062 #endif /* not _AIX */
2063 #endif /* not MSDOS, or __TURBOC__ */
2064 #endif /* not sparc */
2065 #endif /* not GNU C */
2066 #endif /* alloca not defined */
2067 #endif /* YYSTACK_USE_ALLOCA not defined */
2069 #ifdef YYSTACK_USE_ALLOCA
2070 #define YYSTACK_ALLOC alloca
2072 #define YYSTACK_ALLOC malloc
2075 /* Note: there must be only one dollar sign in this file.
2076 It is replaced by the list of actions, each action
2077 as one case of the switch. */
2079 #define yyerrok (yyerrstatus = 0)
2080 #define yyclearin (yychar = YYEMPTY)
2083 #define YYACCEPT goto yyacceptlab
2084 #define YYABORT goto yyabortlab
2085 #define YYERROR goto yyerrlab1
2086 /* Like YYERROR except do call yyerror.
2087 This remains here temporarily to ease the
2088 transition to the new meaning of YYERROR, for GCC.
2089 Once GCC version 2 has supplanted version 1, this can go. */
2090 #define YYFAIL goto yyerrlab
2091 #define YYRECOVERING() (!!yyerrstatus)
2092 #define YYBACKUP(token, value) \
2094 if (yychar == YYEMPTY && yylen == 1) \
2095 { yychar = (token), yylval = (value); \
2096 yychar1 = YYTRANSLATE (yychar); \
2101 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2105 #define YYERRCODE 256
2108 #define YYLEX yylex()
2114 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2116 #define YYLEX yylex(&yylval, &yylloc)
2118 #else /* not YYLSP_NEEDED */
2120 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2122 #define YYLEX yylex(&yylval)
2124 #endif /* not YYLSP_NEEDED */
2127 /* If nonreentrant, generate the variables here */
2131 int yychar; /* the lookahead symbol */
2132 YYSTYPE yylval; /* the semantic value of the */
2133 /* lookahead symbol */
2136 YYLTYPE yylloc; /* location data for the lookahead */
2140 int yynerrs; /* number of parse errors so far */
2141 #endif /* not YYPURE */
2144 int yydebug; /* nonzero means print parse trace */
2145 /* Since this is uninitialized, it does not stop multiple parsers
2149 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2152 #define YYINITDEPTH 200
2155 /* YYMAXDEPTH is the maximum size the stacks can grow to
2156 (effective only if the built-in stack extension method is used). */
2163 #define YYMAXDEPTH 10000
2166 /* Define __yy_memcpy. Note that the size argument
2167 should be passed with type unsigned int, because that is what the non-GCC
2168 definitions require. With GCC, __builtin_memcpy takes an arg
2169 of type size_t, but it can handle unsigned int. */
2171 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2172 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2173 #else /* not GNU C or C++ */
2176 /* This is the most reliable way to avoid incompatibilities
2177 in available built-in functions on various systems. */
2179 __yy_memcpy (to, from, count)
2184 register char *f = from;
2185 register char *t = to;
2186 register int i = count;
2192 #else /* __cplusplus */
2194 /* This is the most reliable way to avoid incompatibilities
2195 in available built-in functions on various systems. */
2197 __yy_memcpy (char *to, char *from, unsigned int count)
2199 register char *t = to;
2200 register char *f = from;
2201 register int i = count;
2210 #line 217 "/usr/share/bison.simple"
2212 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2213 into yyparse. The argument should have type void *.
2214 It should actually point to an object.
2215 Grammar actions can access the variable by casting it
2216 to the proper pointer type. */
2218 #ifdef YYPARSE_PARAM
2220 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2221 #define YYPARSE_PARAM_DECL
2222 #else /* not __cplusplus */
2223 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2224 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2225 #endif /* not __cplusplus */
2226 #else /* not YYPARSE_PARAM */
2227 #define YYPARSE_PARAM_ARG
2228 #define YYPARSE_PARAM_DECL
2229 #endif /* not YYPARSE_PARAM */
2231 /* Prevent warning if -Wstrict-prototypes. */
2233 #ifdef YYPARSE_PARAM
2234 int yyparse (void *);
2241 yyparse(YYPARSE_PARAM_ARG)
2244 register int yystate;
2246 register short *yyssp;
2247 register YYSTYPE *yyvsp;
2248 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2249 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2251 short yyssa[YYINITDEPTH]; /* the state stack */
2252 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2254 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2255 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2258 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2259 YYLTYPE *yyls = yylsa;
2262 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2264 #define YYPOPSTACK (yyvsp--, yyssp--)
2267 int yystacksize = YYINITDEPTH;
2268 int yyfree_stacks = 0;
2279 YYSTYPE yyval; /* the variable used to return */
2280 /* semantic values from the action */
2287 fprintf(stderr, "Starting parse\n");
2293 yychar = YYEMPTY; /* Cause a token to be read. */
2295 /* Initialize stack pointers.
2296 Waste one element of value and location stack
2297 so that they stay on the same level as the state stack.
2298 The wasted elements are never initialized. */
2306 /* Push a new state, which is found in yystate . */
2307 /* In all cases, when you get here, the value and location stacks
2308 have just been pushed. so pushing a state here evens the stacks. */
2313 if (yyssp >= yyss + yystacksize - 1)
2315 /* Give user a chance to reallocate the stack */
2316 /* Use copies of these so that the &'s don't force the real ones into memory. */
2317 YYSTYPE *yyvs1 = yyvs;
2318 short *yyss1 = yyss;
2320 YYLTYPE *yyls1 = yyls;
2323 /* Get the current used size of the three stacks, in elements. */
2324 int size = yyssp - yyss + 1;
2327 /* Each stack pointer address is followed by the size of
2328 the data in use in that stack, in bytes. */
2330 /* This used to be a conditional around just the two extra args,
2331 but that might be undefined if yyoverflow is a macro. */
2332 yyoverflow("parser stack overflow",
2333 &yyss1, size * sizeof (*yyssp),
2334 &yyvs1, size * sizeof (*yyvsp),
2335 &yyls1, size * sizeof (*yylsp),
2338 yyoverflow("parser stack overflow",
2339 &yyss1, size * sizeof (*yyssp),
2340 &yyvs1, size * sizeof (*yyvsp),
2344 yyss = yyss1; yyvs = yyvs1;
2348 #else /* no yyoverflow */
2349 /* Extend the stack our own way. */
2350 if (yystacksize >= YYMAXDEPTH)
2352 yyerror("parser stack overflow");
2364 if (yystacksize > YYMAXDEPTH)
2365 yystacksize = YYMAXDEPTH;
2366 #ifndef YYSTACK_USE_ALLOCA
2369 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2370 __yy_memcpy ((char *)yyss, (char *)yyss1,
2371 size * (unsigned int) sizeof (*yyssp));
2372 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2373 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2374 size * (unsigned int) sizeof (*yyvsp));
2376 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2377 __yy_memcpy ((char *)yyls, (char *)yyls1,
2378 size * (unsigned int) sizeof (*yylsp));
2380 #endif /* no yyoverflow */
2382 yyssp = yyss + size - 1;
2383 yyvsp = yyvs + size - 1;
2385 yylsp = yyls + size - 1;
2390 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2393 if (yyssp >= yyss + yystacksize - 1)
2399 fprintf(stderr, "Entering state %d\n", yystate);
2405 /* Do appropriate processing given the current state. */
2406 /* Read a lookahead token if we need one and don't already have one. */
2409 /* First try to decide what to do without reference to lookahead token. */
2411 yyn = yypact[yystate];
2415 /* Not known => get a lookahead token if don't already have one. */
2417 /* yychar is either YYEMPTY or YYEOF
2418 or a valid token in external form. */
2420 if (yychar == YYEMPTY)
2424 fprintf(stderr, "Reading a token: ");
2429 /* Convert token to internal form (in yychar1) for indexing tables with */
2431 if (yychar <= 0) /* This means end of input. */
2434 yychar = YYEOF; /* Don't call YYLEX any more */
2438 fprintf(stderr, "Now at end of input.\n");
2443 yychar1 = YYTRANSLATE(yychar);
2448 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2449 /* Give the individual parser a way to print the precise meaning
2450 of a token, for further debugging info. */
2452 YYPRINT (stderr, yychar, yylval);
2454 fprintf (stderr, ")\n");
2460 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2465 /* yyn is what to do for this token type in this state.
2466 Negative => reduce, -yyn is rule number.
2467 Positive => shift, yyn is new state.
2468 New state is final state => don't bother to shift,
2469 just return success.
2470 0, or most negative number => error. */
2485 /* Shift the lookahead token. */
2489 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2492 /* Discard the token being shifted unless it is eof. */
2493 if (yychar != YYEOF)
2501 /* count tokens shifted since error; after three, turn off error status. */
2502 if (yyerrstatus) yyerrstatus--;
2507 /* Do the default action for the current state. */
2510 yyn = yydefact[yystate];
2514 /* Do a reduction. yyn is the number of a rule to reduce with. */
2518 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2525 fprintf (stderr, "Reducing via rule %d (line %d), ",
2528 /* Print the symbols being reduced, and their result. */
2529 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2530 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2531 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2539 #line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2540 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2543 #line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2544 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2547 #line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2548 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2551 #line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2552 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2555 #line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2556 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2559 #line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2560 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2563 #line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2564 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2567 #line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2568 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2571 #line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2572 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2575 #line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2576 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2579 #line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2580 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2583 #line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2584 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2587 #line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2588 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2591 #line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2592 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2595 #line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2596 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2599 #line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2600 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2603 #line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2604 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2607 #line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2608 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2611 #line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2612 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2615 #line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2616 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2619 #line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2620 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2623 #line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2624 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2627 #line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2628 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2631 #line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2632 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2635 #line 1147 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2636 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2639 #line 1148 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2640 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2643 #line 1157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2644 { yyval.StrVal = 0; ;
2647 #line 1161 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2649 yyval.StrVal = yyvsp[-1].StrVal;
2654 #line 1165 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2661 #line 1173 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2668 #line 1178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2670 yyval.StrVal = yyvsp[-1].StrVal;
2675 #line 1184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2676 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2679 #line 1185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2680 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2683 #line 1186 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2684 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2687 #line 1187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2688 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2691 #line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2692 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2695 #line 1192 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2696 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2699 #line 1193 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2700 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2703 #line 1194 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2704 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2707 #line 1198 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2708 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2711 #line 1199 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2712 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2715 #line 1200 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2716 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2719 #line 1201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2720 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2723 #line 1205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2724 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2727 #line 1206 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2728 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2731 #line 1207 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2732 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2735 #line 1211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2736 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2739 #line 1212 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2740 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2743 #line 1213 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2744 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2747 #line 1214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2748 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2751 #line 1215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2752 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2755 #line 1219 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2756 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2759 #line 1220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2760 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2763 #line 1221 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2764 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2767 #line 1224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2768 { yyval.UIntVal = CallingConv::C; ;
2771 #line 1225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2772 { yyval.UIntVal = CallingConv::C; ;
2775 #line 1226 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2776 { yyval.UIntVal = CallingConv::Fast; ;
2779 #line 1227 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2780 { yyval.UIntVal = CallingConv::Cold; ;
2783 #line 1228 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2784 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2787 #line 1229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2788 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2791 #line 1230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2793 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2794 GEN_ERROR("Calling conv too large");
2795 yyval.UIntVal = yyvsp[0].UInt64Val;
2800 #line 1237 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2801 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2804 #line 1238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2805 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2808 #line 1239 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2809 { yyval.ParamAttrs = ParamAttr::SExt; ;
2812 #line 1240 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2813 { yyval.ParamAttrs = ParamAttr::SExt; ;
2816 #line 1241 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2817 { yyval.ParamAttrs = ParamAttr::InReg; ;
2820 #line 1242 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2821 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2824 #line 1243 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2825 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2828 #line 1244 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2829 { yyval.ParamAttrs = ParamAttr::ByVal; ;
2832 #line 1245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2833 { yyval.ParamAttrs = ParamAttr::Nest; ;
2836 #line 1248 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2837 { yyval.ParamAttrs = ParamAttr::None; ;
2840 #line 1249 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2842 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2846 #line 1254 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2847 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2850 #line 1255 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2851 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2854 #line 1256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2855 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2858 #line 1257 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2859 { yyval.ParamAttrs = ParamAttr::SExt; ;
2862 #line 1260 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2863 { yyval.ParamAttrs = ParamAttr::None; ;
2866 #line 1261 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2868 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2872 #line 1268 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2873 { yyval.UIntVal = 0; ;
2876 #line 1269 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2878 yyval.UIntVal = yyvsp[0].UInt64Val;
2879 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2880 GEN_ERROR("Alignment must be a power of two");
2885 #line 1275 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2886 { yyval.UIntVal = 0; ;
2889 #line 1276 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2891 yyval.UIntVal = yyvsp[0].UInt64Val;
2892 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2893 GEN_ERROR("Alignment must be a power of two");
2898 #line 1284 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2900 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2901 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2902 GEN_ERROR("Invalid character in section name");
2903 yyval.StrVal = yyvsp[0].StrVal;
2908 #line 1292 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2909 { yyval.StrVal = 0; ;
2912 #line 1293 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2913 { yyval.StrVal = yyvsp[0].StrVal; ;
2916 #line 1298 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2920 #line 1299 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2924 #line 1300 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2926 CurGV->setSection(*yyvsp[0].StrVal);
2927 delete yyvsp[0].StrVal;
2932 #line 1305 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2934 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2935 GEN_ERROR("Alignment must be a power of two");
2936 CurGV->setAlignment(yyvsp[0].UInt64Val);
2941 #line 1321 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2943 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2948 #line 1325 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2950 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2955 #line 1329 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2957 if (*yyvsp[-1].TypeVal == Type::LabelTy)
2958 GEN_ERROR("Cannot form a pointer to a basic block");
2959 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2960 delete yyvsp[-1].TypeVal;
2965 #line 1336 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2966 { // Named types are also simple types...
2967 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
2969 yyval.TypeVal = new PATypeHolder(tmp);
2973 #line 1341 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2974 { // Type UpReference
2975 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
2976 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2977 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2978 yyval.TypeVal = new PATypeHolder(OT);
2979 UR_OUT("New Upreference!\n");
2984 #line 1349 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2986 std::vector<const Type*> Params;
2987 ParamAttrsVector Attrs;
2988 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
2989 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
2993 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
2994 for (; I != E; ++I, ++index) {
2995 const Type *Ty = I->Ty->get();
2996 Params.push_back(Ty);
2997 if (Ty != Type::VoidTy)
2998 if (I->Attrs != ParamAttr::None) {
2999 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3003 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3004 if (isVarArg) Params.pop_back();
3006 ParamAttrsList *ActualAttrs = 0;
3008 ActualAttrs = ParamAttrsList::get(Attrs);
3009 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3010 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3011 delete yyvsp[-4].TypeVal; // Delete the return type handle
3012 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3017 #line 1379 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3019 std::vector<const Type*> Params;
3020 ParamAttrsVector Attrs;
3021 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3022 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3025 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3027 for ( ; I != E; ++I, ++index) {
3028 const Type* Ty = I->Ty->get();
3029 Params.push_back(Ty);
3030 if (Ty != Type::VoidTy)
3031 if (I->Attrs != ParamAttr::None) {
3032 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3036 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3037 if (isVarArg) Params.pop_back();
3039 ParamAttrsList *ActualAttrs = 0;
3041 ActualAttrs = ParamAttrsList::get(Attrs);
3043 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3044 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3045 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3050 #line 1410 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3051 { // Sized array type?
3052 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3053 delete yyvsp[-1].TypeVal;
3058 #line 1415 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3060 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3061 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3062 GEN_ERROR("Unsigned result not equal to signed result");
3063 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3064 GEN_ERROR("Element type of a VectorType must be primitive");
3065 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3066 GEN_ERROR("Vector length should be a power of 2");
3067 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3068 delete yyvsp[-1].TypeVal;
3073 #line 1427 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3074 { // Structure type?
3075 std::vector<const Type*> Elements;
3076 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3077 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3078 Elements.push_back(*I);
3080 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3081 delete yyvsp[-1].TypeList;
3086 #line 1437 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3087 { // Empty structure type?
3088 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3093 #line 1441 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3095 std::vector<const Type*> Elements;
3096 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3097 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3098 Elements.push_back(*I);
3100 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3101 delete yyvsp[-2].TypeList;
3106 #line 1451 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3107 { // Empty structure type?
3108 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3113 #line 1458 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3115 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3116 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3120 #line 1465 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3122 if (!UpRefs.empty())
3123 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3124 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3125 GEN_ERROR("LLVM functions cannot return aggregate types");
3126 yyval.TypeVal = yyvsp[0].TypeVal;
3130 #line 1472 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3132 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3136 #line 1477 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3138 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3139 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3144 #line 1482 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3146 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3151 #line 1490 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3153 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3154 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3155 TWA.Ty = new PATypeHolder(Type::VoidTy);
3156 yyval.TypeWithAttrsList->push_back(TWA);
3161 #line 1497 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3163 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3164 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3165 TWA.Ty = new PATypeHolder(Type::VoidTy);
3166 yyval.TypeWithAttrsList->push_back(TWA);
3171 #line 1504 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3173 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3178 #line 1512 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3180 yyval.TypeList = new std::list<PATypeHolder>();
3181 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3182 delete yyvsp[0].TypeVal;
3187 #line 1518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3189 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3190 delete yyvsp[0].TypeVal;
3195 #line 1530 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3196 { // Nonempty unsized arr
3197 if (!UpRefs.empty())
3198 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3199 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3201 GEN_ERROR("Cannot make array constant with type: '" +
3202 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3203 const Type *ETy = ATy->getElementType();
3204 int NumElements = ATy->getNumElements();
3206 // Verify that we have the correct size...
3207 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3208 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3209 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3210 itostr(NumElements) + "");
3212 // Verify all elements are correct type!
3213 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3214 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3215 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3216 ETy->getDescription() +"' as required!\nIt is of type '"+
3217 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3220 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3221 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3226 #line 1558 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3228 if (!UpRefs.empty())
3229 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3230 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3232 GEN_ERROR("Cannot make array constant with type: '" +
3233 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3235 int NumElements = ATy->getNumElements();
3236 if (NumElements != -1 && NumElements != 0)
3237 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3238 " arguments, but has size of " + itostr(NumElements) +"");
3239 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3240 delete yyvsp[-2].TypeVal;
3245 #line 1574 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3247 if (!UpRefs.empty())
3248 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3249 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3251 GEN_ERROR("Cannot make array constant with type: '" +
3252 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3254 int NumElements = ATy->getNumElements();
3255 const Type *ETy = ATy->getElementType();
3256 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3257 GEN_ERROR("Can't build string constant of size " +
3258 itostr((int)(yyvsp[0].StrVal->length())) +
3259 " when array has size " + itostr(NumElements) + "");
3260 std::vector<Constant*> Vals;
3261 if (ETy == Type::Int8Ty) {
3262 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3263 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3265 delete yyvsp[0].StrVal;
3266 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3268 delete yyvsp[0].StrVal;
3269 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3270 delete yyvsp[-2].TypeVal;
3275 #line 1601 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3276 { // Nonempty unsized arr
3277 if (!UpRefs.empty())
3278 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3279 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3281 GEN_ERROR("Cannot make packed constant with type: '" +
3282 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3283 const Type *ETy = PTy->getElementType();
3284 int NumElements = PTy->getNumElements();
3286 // Verify that we have the correct size...
3287 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3288 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3289 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3290 itostr(NumElements) + "");
3292 // Verify all elements are correct type!
3293 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3294 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3295 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3296 ETy->getDescription() +"' as required!\nIt is of type '"+
3297 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3300 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3301 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3306 #line 1629 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3308 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3310 GEN_ERROR("Cannot make struct constant with type: '" +
3311 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3313 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3314 GEN_ERROR("Illegal number of initializers for structure type");
3316 // Check to ensure that constants are compatible with the type initializer!
3317 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3318 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3319 GEN_ERROR("Expected type '" +
3320 STy->getElementType(i)->getDescription() +
3321 "' for element #" + utostr(i) +
3322 " of structure initializer");
3324 // Check to ensure that Type is not packed
3325 if (STy->isPacked())
3326 GEN_ERROR("Unpacked Initializer to vector type '" +
3327 STy->getDescription() + "'");
3329 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3330 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3335 #line 1655 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3337 if (!UpRefs.empty())
3338 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3339 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3341 GEN_ERROR("Cannot make struct constant with type: '" +
3342 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3344 if (STy->getNumContainedTypes() != 0)
3345 GEN_ERROR("Illegal number of initializers for structure type");
3347 // Check to ensure that Type is not packed
3348 if (STy->isPacked())
3349 GEN_ERROR("Unpacked Initializer to vector type '" +
3350 STy->getDescription() + "'");
3352 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3353 delete yyvsp[-2].TypeVal;
3358 #line 1675 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3360 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3362 GEN_ERROR("Cannot make struct constant with type: '" +
3363 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3365 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3366 GEN_ERROR("Illegal number of initializers for structure type");
3368 // Check to ensure that constants are compatible with the type initializer!
3369 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3370 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3371 GEN_ERROR("Expected type '" +
3372 STy->getElementType(i)->getDescription() +
3373 "' for element #" + utostr(i) +
3374 " of structure initializer");
3376 // Check to ensure that Type is packed
3377 if (!STy->isPacked())
3378 GEN_ERROR("Vector initializer to non-vector type '" +
3379 STy->getDescription() + "'");
3381 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3382 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3387 #line 1701 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3389 if (!UpRefs.empty())
3390 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3391 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3393 GEN_ERROR("Cannot make struct constant with type: '" +
3394 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3396 if (STy->getNumContainedTypes() != 0)
3397 GEN_ERROR("Illegal number of initializers for structure type");
3399 // Check to ensure that Type is packed
3400 if (!STy->isPacked())
3401 GEN_ERROR("Vector initializer to non-vector type '" +
3402 STy->getDescription() + "'");
3404 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3405 delete yyvsp[-4].TypeVal;
3410 #line 1721 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3412 if (!UpRefs.empty())
3413 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3414 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3416 GEN_ERROR("Cannot make null pointer constant with type: '" +
3417 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3419 yyval.ConstVal = ConstantPointerNull::get(PTy);
3420 delete yyvsp[-1].TypeVal;
3425 #line 1733 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3427 if (!UpRefs.empty())
3428 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3429 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3430 delete yyvsp[-1].TypeVal;
3435 #line 1740 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3437 if (!UpRefs.empty())
3438 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3439 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3441 GEN_ERROR("Global const reference must be a pointer type");
3443 // ConstExprs can exist in the body of a function, thus creating
3444 // GlobalValues whenever they refer to a variable. Because we are in
3445 // the context of a function, getExistingVal will search the functions
3446 // symbol table instead of the module symbol table for the global symbol,
3447 // which throws things all off. To get around this, we just tell
3448 // getExistingVal that we are at global scope here.
3450 Function *SavedCurFn = CurFun.CurrentFunction;
3451 CurFun.CurrentFunction = 0;
3453 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3456 CurFun.CurrentFunction = SavedCurFn;
3458 // If this is an initializer for a constant pointer, which is referencing a
3459 // (currently) undefined variable, create a stub now that shall be replaced
3460 // in the future with the right type of variable.
3463 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3464 const PointerType *PT = cast<PointerType>(Ty);
3466 // First check to see if the forward references value is already created!
3467 PerModuleInfo::GlobalRefsType::iterator I =
3468 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3470 if (I != CurModule.GlobalRefs.end()) {
3471 V = I->second; // Placeholder already exists, use it...
3472 yyvsp[0].ValIDVal.destroy();
3475 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3476 Name = yyvsp[0].ValIDVal.getName();
3477 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3478 GEN_ERROR("Invalid reference to global");
3480 // Create the forward referenced global.
3482 if (const FunctionType *FTy =
3483 dyn_cast<FunctionType>(PT->getElementType())) {
3484 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3485 CurModule.CurrentModule);
3487 GV = new GlobalVariable(PT->getElementType(), false,
3488 GlobalValue::ExternalWeakLinkage, 0,
3489 Name, CurModule.CurrentModule);
3492 // Keep track of the fact that we have a forward ref to recycle it
3493 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3498 yyval.ConstVal = cast<GlobalValue>(V);
3499 delete yyvsp[-1].TypeVal; // Free the type handle
3504 #line 1806 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3506 if (!UpRefs.empty())
3507 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3508 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3509 GEN_ERROR("Mismatched types for constant expression: " +
3510 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3511 yyval.ConstVal = yyvsp[0].ConstVal;
3512 delete yyvsp[-1].TypeVal;
3517 #line 1816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3519 if (!UpRefs.empty())
3520 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3521 const Type *Ty = yyvsp[-1].TypeVal->get();
3522 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3523 GEN_ERROR("Cannot create a null initialized value of this type");
3524 yyval.ConstVal = Constant::getNullValue(Ty);
3525 delete yyvsp[-1].TypeVal;
3530 #line 1826 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3531 { // integral constants
3532 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3533 GEN_ERROR("Constant value doesn't fit in type");
3534 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3539 #line 1832 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3540 { // arbitrary precision integer constants
3541 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3542 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3543 GEN_ERROR("Constant value does not fit in type");
3545 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3546 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3547 delete yyvsp[0].APIntVal;
3552 #line 1842 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3553 { // integral constants
3554 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3555 GEN_ERROR("Constant value doesn't fit in type");
3556 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3561 #line 1848 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3562 { // arbitrary precision integer constants
3563 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3564 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3565 GEN_ERROR("Constant value does not fit in type");
3567 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3568 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3569 delete yyvsp[0].APIntVal;
3574 #line 1858 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3575 { // Boolean constants
3576 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3577 yyval.ConstVal = ConstantInt::getTrue();
3582 #line 1863 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3583 { // Boolean constants
3584 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3585 yyval.ConstVal = ConstantInt::getFalse();
3590 #line 1868 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3591 { // Float & Double constants
3592 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
3593 GEN_ERROR("Floating point constant invalid for type");
3594 // Lexer has no type info, so builds all FP constants as double.
3596 if (yyvsp[-1].PrimType==Type::FloatTy)
3597 yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
3598 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
3599 delete yyvsp[0].FPVal;
3604 #line 1881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3606 if (!UpRefs.empty())
3607 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3608 Constant *Val = yyvsp[-3].ConstVal;
3609 const Type *DestTy = yyvsp[-1].TypeVal->get();
3610 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3611 GEN_ERROR("invalid cast opcode for cast from '" +
3612 Val->getType()->getDescription() + "' to '" +
3613 DestTy->getDescription() + "'");
3614 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3615 delete yyvsp[-1].TypeVal;
3619 #line 1893 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3621 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3622 GEN_ERROR("GetElementPtr requires a pointer operand");
3625 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
3628 GEN_ERROR("Index list invalid for constant getelementptr");
3630 SmallVector<Constant*, 8> IdxVec;
3631 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3632 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3633 IdxVec.push_back(C);
3635 GEN_ERROR("Indices to constant getelementptr must be constants");
3637 delete yyvsp[-1].ValueList;
3639 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3644 #line 1915 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3646 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3647 GEN_ERROR("Select condition must be of boolean type");
3648 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3649 GEN_ERROR("Select operand types must match");
3650 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3655 #line 1923 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3657 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3658 GEN_ERROR("Binary operator types must match");
3660 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3664 #line 1929 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3666 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3667 GEN_ERROR("Logical operator types must match");
3668 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3669 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3670 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3671 GEN_ERROR("Logical operator requires integral operands");
3673 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3678 #line 1940 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3680 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3681 GEN_ERROR("icmp operand types must match");
3682 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3686 #line 1945 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3688 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3689 GEN_ERROR("fcmp operand types must match");
3690 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3694 #line 1950 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3696 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3697 GEN_ERROR("Invalid extractelement operands");
3698 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3703 #line 1956 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3705 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3706 GEN_ERROR("Invalid insertelement operands");
3707 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3712 #line 1962 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3714 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3715 GEN_ERROR("Invalid shufflevector operands");
3716 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3721 #line 1971 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3723 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3728 #line 1975 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3730 yyval.ConstVector = new std::vector<Constant*>();
3731 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3736 #line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3737 { yyval.BoolVal = false; ;
3740 #line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3741 { yyval.BoolVal = true; ;
3744 #line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3745 { yyval.BoolVal = true; ;
3748 #line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3749 { yyval.BoolVal = false; ;
3752 #line 1989 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3754 const Type* VTy = yyvsp[-1].TypeVal->get();
3755 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3757 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3759 GEN_ERROR("Aliases can be created only to global values");
3761 yyval.ConstVal = Aliasee;
3763 delete yyvsp[-1].TypeVal;
3767 #line 2001 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3769 Constant *Val = yyvsp[-3].ConstVal;
3770 const Type *DestTy = yyvsp[-1].TypeVal->get();
3771 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3772 GEN_ERROR("invalid cast opcode for cast from '" +
3773 Val->getType()->getDescription() + "' to '" +
3774 DestTy->getDescription() + "'");
3776 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3778 delete yyvsp[-1].TypeVal;
3782 #line 2022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3784 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3785 CurModule.ModuleDone();
3790 #line 2027 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3792 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3793 CurModule.ModuleDone();
3798 #line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3799 { CurFun.isDeclare = false; ;
3802 #line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3804 CurFun.FunctionDone();
3809 #line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3810 { CurFun.isDeclare = true; ;
3813 #line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3819 #line 2047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3825 #line 2050 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3827 if (!UpRefs.empty())
3828 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3829 // Eagerly resolve types. This is not an optimization, this is a
3830 // requirement that is due to the fact that we could have this:
3832 // %list = type { %list * }
3833 // %list = type { %list * } ; repeated type decl
3835 // If types are not resolved eagerly, then the two types will not be
3836 // determined to be the same type!
3838 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3840 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3842 // If this is a named type that is not a redefinition, add it to the slot
3844 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3847 delete yyvsp[0].TypeVal;
3852 #line 2074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3854 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3856 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3858 // If this is a named type that is not a redefinition, add it to the slot
3860 CurModule.Types.push_back(yyvsp[0].PrimType);
3866 #line 2085 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3868 /* "Externally Visible" Linkage */
3869 if (yyvsp[0].ConstVal == 0)
3870 GEN_ERROR("Global value initializer is not a constant");
3871 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3872 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3877 #line 2092 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3883 #line 2096 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3885 if (yyvsp[0].ConstVal == 0)
3886 GEN_ERROR("Global value initializer is not a constant");
3887 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3892 #line 2101 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3898 #line 2105 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3900 if (!UpRefs.empty())
3901 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3902 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
3904 delete yyvsp[0].TypeVal;
3908 #line 2111 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3915 #line 2115 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3918 if (yyvsp[-4].StrVal) {
3919 Name = *yyvsp[-4].StrVal;
3920 delete yyvsp[-4].StrVal;
3923 GEN_ERROR("Alias name cannot be empty");
3925 Constant* Aliasee = yyvsp[0].ConstVal;
3927 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3929 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
3930 CurModule.CurrentModule);
3931 GA->setVisibility(yyvsp[-3].Visibility);
3932 InsertValue(GA, CurModule.Values);
3935 // If there was a forward reference of this alias, resolve it now.
3939 ID = ValID::createGlobalName(Name);
3941 ID = ValID::createGlobalID(CurModule.Values.size()-1);
3943 if (GlobalValue *FWGV =
3944 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
3945 // Replace uses of the fwdref with the actual alias.
3946 FWGV->replaceAllUsesWith(GA);
3947 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
3948 GV->eraseFromParent();
3950 cast<Function>(FWGV)->eraseFromParent();
3958 #line 2155 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3964 #line 2158 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3970 #line 2164 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3972 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3973 if (AsmSoFar.empty())
3974 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
3976 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
3977 delete yyvsp[0].StrVal;
3982 #line 2174 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3984 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
3985 delete yyvsp[0].StrVal;
3989 #line 2178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3991 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
3992 delete yyvsp[0].StrVal;
3996 #line 2185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3998 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3999 delete yyvsp[0].StrVal;
4004 #line 2190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4006 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4007 delete yyvsp[0].StrVal;
4012 #line 2195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4018 #line 2204 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4020 if (!UpRefs.empty())
4021 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4022 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4023 GEN_ERROR("void typed arguments are invalid");
4024 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4025 yyval.ArgList = yyvsp[-4].ArgList;
4026 yyvsp[-4].ArgList->push_back(E);
4031 #line 2214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4033 if (!UpRefs.empty())
4034 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4035 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4036 GEN_ERROR("void typed arguments are invalid");
4037 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4038 yyval.ArgList = new ArgListType;
4039 yyval.ArgList->push_back(E);
4044 #line 2225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4046 yyval.ArgList = yyvsp[0].ArgList;
4051 #line 2229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4053 yyval.ArgList = yyvsp[-2].ArgList;
4054 struct ArgListEntry E;
4055 E.Ty = new PATypeHolder(Type::VoidTy);
4057 E.Attrs = ParamAttr::None;
4058 yyval.ArgList->push_back(E);
4063 #line 2238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4065 yyval.ArgList = new ArgListType;
4066 struct ArgListEntry E;
4067 E.Ty = new PATypeHolder(Type::VoidTy);
4069 E.Attrs = ParamAttr::None;
4070 yyval.ArgList->push_back(E);
4075 #line 2247 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4082 #line 2253 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4084 std::string FunctionName(*yyvsp[-6].StrVal);
4085 delete yyvsp[-6].StrVal; // Free strdup'd memory!
4087 // Check the function result for abstractness if this is a define. We should
4088 // have no abstract types at this point
4089 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4090 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4092 std::vector<const Type*> ParamTypeList;
4093 ParamAttrsVector Attrs;
4094 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4095 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4096 Attrs.push_back(PAWI);
4098 if (yyvsp[-4].ArgList) { // If there are arguments...
4100 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4101 const Type* Ty = I->Ty->get();
4102 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4103 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4104 ParamTypeList.push_back(Ty);
4105 if (Ty != Type::VoidTy)
4106 if (I->Attrs != ParamAttr::None) {
4107 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4108 Attrs.push_back(PAWI);
4113 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4114 if (isVarArg) ParamTypeList.pop_back();
4116 ParamAttrsList *PAL = 0;
4118 PAL = ParamAttrsList::get(Attrs);
4120 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4121 const PointerType *PFT = PointerType::get(FT);
4122 delete yyvsp[-7].TypeVal;
4125 if (!FunctionName.empty()) {
4126 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4128 ID = ValID::createGlobalID(CurModule.Values.size());
4132 // See if this function was forward referenced. If so, recycle the object.
4133 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4134 // Move the function to the end of the list, from whereever it was
4135 // previously inserted.
4136 Fn = cast<Function>(FWRef);
4137 CurModule.CurrentModule->getFunctionList().remove(Fn);
4138 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4139 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4140 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4141 if (Fn->getFunctionType() != FT) {
4142 // The existing function doesn't have the same type. This is an overload
4144 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4145 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4146 // Neither the existing or the current function is a declaration and they
4147 // have the same name and same type. Clearly this is a redefinition.
4148 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4149 } if (Fn->isDeclaration()) {
4150 // Make sure to strip off any argument names so we can't get conflicts.
4151 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4155 } else { // Not already defined?
4156 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4157 CurModule.CurrentModule);
4159 InsertValue(Fn, CurModule.Values);
4162 CurFun.FunctionStart(Fn);
4164 if (CurFun.isDeclare) {
4165 // If we have declaration, always overwrite linkage. This will allow us to
4166 // correctly handle cases, when pointer to function is passed as argument to
4167 // another function.
4168 Fn->setLinkage(CurFun.Linkage);
4169 Fn->setVisibility(CurFun.Visibility);
4171 Fn->setCallingConv(yyvsp[-8].UIntVal);
4172 Fn->setAlignment(yyvsp[0].UIntVal);
4173 if (yyvsp[-1].StrVal) {
4174 Fn->setSection(*yyvsp[-1].StrVal);
4175 delete yyvsp[-1].StrVal;
4178 // Add all of the arguments we parsed to the function...
4179 if (yyvsp[-4].ArgList) { // Is null if empty...
4180 if (isVarArg) { // Nuke the last entry
4181 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4182 "Not a varargs marker!");
4183 delete yyvsp[-4].ArgList->back().Ty;
4184 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4186 Function::arg_iterator ArgIt = Fn->arg_begin();
4187 Function::arg_iterator ArgEnd = Fn->arg_end();
4189 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4190 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4191 delete I->Ty; // Delete the typeholder...
4192 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4198 delete yyvsp[-4].ArgList; // We're now done with the argument list
4204 #line 2375 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4206 yyval.FunctionVal = CurFun.CurrentFunction;
4208 // Make sure that we keep track of the linkage type even if there was a
4209 // previous "declare".
4210 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4211 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4215 #line 2386 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4217 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4222 #line 2391 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4224 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4225 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4226 yyval.FunctionVal = CurFun.CurrentFunction;
4227 CurFun.FunctionDone();
4232 #line 2403 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4234 yyval.BoolVal = false;
4239 #line 2407 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4241 yyval.BoolVal = true;
4246 #line 2412 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4247 { // A reference to a direct constant
4248 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4253 #line 2416 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4255 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4260 #line 2420 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4261 { // Perhaps it's an FP constant?
4262 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4267 #line 2424 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4269 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4274 #line 2428 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4276 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4281 #line 2432 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4283 yyval.ValIDVal = ValID::createNull();
4288 #line 2436 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4290 yyval.ValIDVal = ValID::createUndef();
4295 #line 2440 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4296 { // A vector zero constant.
4297 yyval.ValIDVal = ValID::createZeroInit();
4302 #line 2444 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4303 { // Nonempty unsized packed vector
4304 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4305 int NumElements = yyvsp[-1].ConstVector->size();
4307 VectorType* pt = VectorType::get(ETy, NumElements);
4308 PATypeHolder* PTy = new PATypeHolder(
4316 // Verify all elements are correct type!
4317 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4318 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4319 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4320 ETy->getDescription() +"' as required!\nIt is of type '" +
4321 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4324 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4325 delete PTy; delete yyvsp[-1].ConstVector;
4330 #line 2469 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4332 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4337 #line 2473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4339 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4340 delete yyvsp[-2].StrVal;
4341 delete yyvsp[0].StrVal;
4346 #line 2483 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4347 { // Is it an integer reference...?
4348 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4353 #line 2487 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4355 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4360 #line 2491 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4361 { // Is it a named reference...?
4362 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4363 delete yyvsp[0].StrVal;
4368 #line 2496 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4369 { // Is it a named reference...?
4370 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4371 delete yyvsp[0].StrVal;
4376 #line 2509 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4378 if (!UpRefs.empty())
4379 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4380 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4381 delete yyvsp[-1].TypeVal;
4386 #line 2518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4388 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4393 #line 2522 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4394 { // Do not allow functions with 0 basic blocks
4395 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4400 #line 2531 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4402 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4404 InsertValue(yyvsp[0].TermInstVal);
4405 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4406 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4411 #line 2540 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4413 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4414 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4415 if (CI2->getParent() == 0)
4416 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4417 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4418 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4423 #line 2549 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4424 { // Empty space between instruction lists
4425 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4430 #line 2553 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4431 { // Labelled (named) basic block
4432 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4433 delete yyvsp[0].StrVal;
4439 #line 2560 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4440 { // Return with a result...
4441 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4446 #line 2564 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4447 { // Return with no result...
4448 yyval.TermInstVal = new ReturnInst();
4453 #line 2568 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4454 { // Unconditional Branch...
4455 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4457 yyval.TermInstVal = new BranchInst(tmpBB);
4461 #line 2573 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4463 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4464 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4466 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4468 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4470 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4474 #line 2583 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4476 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4478 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4480 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4481 yyval.TermInstVal = S;
4483 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4484 E = yyvsp[-1].JumpTable->end();
4485 for (; I != E; ++I) {
4486 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4487 S->addCase(CI, I->second);
4489 GEN_ERROR("Switch case is constant, but not a simple integer");
4491 delete yyvsp[-1].JumpTable;
4496 #line 2602 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4498 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4500 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4502 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4503 yyval.TermInstVal = S;
4508 #line 2612 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4511 // Handle the short syntax
4512 const PointerType *PFTy = 0;
4513 const FunctionType *Ty = 0;
4514 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4515 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4516 // Pull out the types of all of the arguments...
4517 std::vector<const Type*> ParamTypes;
4518 ParamAttrsVector Attrs;
4519 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4520 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4521 Attrs.push_back(PAWI);
4523 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
4525 for (; I != E; ++I, ++index) {
4526 const Type *Ty = I->Val->getType();
4527 if (Ty == Type::VoidTy)
4528 GEN_ERROR("Short call syntax cannot be used with varargs");
4529 ParamTypes.push_back(Ty);
4530 if (I->Attrs != ParamAttr::None) {
4531 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4532 Attrs.push_back(PAWI);
4536 ParamAttrsList *PAL = 0;
4538 PAL = ParamAttrsList::get(Attrs);
4539 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
4540 PFTy = PointerType::get(Ty);
4543 delete yyvsp[-11].TypeVal;
4545 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4547 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4549 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4552 // Check the arguments
4554 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
4555 // Make sure no arguments is a good thing!
4556 if (Ty->getNumParams() != 0)
4557 GEN_ERROR("No arguments passed to a function that "
4558 "expects arguments");
4559 } else { // Has arguments?
4560 // Loop through FunctionType's arguments and ensure they are specified
4562 FunctionType::param_iterator I = Ty->param_begin();
4563 FunctionType::param_iterator E = Ty->param_end();
4564 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
4566 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4567 if (ArgI->Val->getType() != *I)
4568 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4569 (*I)->getDescription() + "'");
4570 Args.push_back(ArgI->Val);
4573 if (Ty->isVarArg()) {
4575 for (; ArgI != ArgE; ++ArgI)
4576 Args.push_back(ArgI->Val); // push the remaining varargs
4577 } else if (I != E || ArgI != ArgE)
4578 GEN_ERROR("Invalid number of parameters detected");
4581 // Create the InvokeInst
4582 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
4583 II->setCallingConv(yyvsp[-12].UIntVal);
4584 yyval.TermInstVal = II;
4585 delete yyvsp[-8].ValueRefList;
4590 #line 2691 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4592 yyval.TermInstVal = new UnwindInst();
4597 #line 2695 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4599 yyval.TermInstVal = new UnreachableInst();
4604 #line 2702 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4606 yyval.JumpTable = yyvsp[-5].JumpTable;
4607 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4610 GEN_ERROR("May only switch on a constant pool value");
4612 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4614 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4618 #line 2713 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4620 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4621 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4625 GEN_ERROR("May only switch on a constant pool value");
4627 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4629 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4633 #line 2726 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4635 // Is this definition named?? if so, assign the name...
4636 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4638 InsertValue(yyvsp[0].InstVal);
4639 yyval.InstVal = yyvsp[0].InstVal;
4644 #line 2736 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4645 { // Used for PHI nodes
4646 if (!UpRefs.empty())
4647 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4648 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4649 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4651 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4653 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4654 delete yyvsp[-5].TypeVal;
4658 #line 2747 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4660 yyval.PHIList = yyvsp[-6].PHIList;
4661 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4663 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4665 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4669 #line 2757 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4671 if (!UpRefs.empty())
4672 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4673 // Used for call and invoke instructions
4674 yyval.ValueRefList = new ValueRefList();
4675 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4676 yyval.ValueRefList->push_back(E);
4677 delete yyvsp[-2].TypeVal;
4681 #line 2766 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4683 if (!UpRefs.empty())
4684 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4685 yyval.ValueRefList = yyvsp[-4].ValueRefList;
4686 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4687 yyval.ValueRefList->push_back(E);
4688 delete yyvsp[-2].TypeVal;
4693 #line 2775 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4694 { yyval.ValueRefList = new ValueRefList(); ;
4697 #line 2778 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4698 { yyval.ValueList = new std::vector<Value*>(); ;
4701 #line 2779 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4703 yyval.ValueList = yyvsp[-2].ValueList;
4704 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4709 #line 2786 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4711 yyval.BoolVal = true;
4716 #line 2790 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4718 yyval.BoolVal = false;
4723 #line 2795 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4725 if (!UpRefs.empty())
4726 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4727 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4728 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4730 "Arithmetic operator requires integer, FP, or packed operands");
4731 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4732 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4733 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4734 yyvsp[-4].BinaryOpVal == Instruction::FRem))
4735 GEN_ERROR("Remainder not supported on vector types");
4736 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4738 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4740 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4741 if (yyval.InstVal == 0)
4742 GEN_ERROR("binary operator returned null");
4743 delete yyvsp[-3].TypeVal;
4747 #line 2816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4749 if (!UpRefs.empty())
4750 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4751 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4752 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4753 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4754 GEN_ERROR("Logical operator requires integral operands");
4756 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4758 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4760 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4761 if (yyval.InstVal == 0)
4762 GEN_ERROR("binary operator returned null");
4763 delete yyvsp[-3].TypeVal;
4767 #line 2833 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4769 if (!UpRefs.empty())
4770 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4771 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4772 GEN_ERROR("Vector types not supported by icmp instruction");
4773 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4775 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4777 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4778 if (yyval.InstVal == 0)
4779 GEN_ERROR("icmp operator returned null");
4780 delete yyvsp[-3].TypeVal;
4784 #line 2847 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4786 if (!UpRefs.empty())
4787 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4788 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4789 GEN_ERROR("Vector types not supported by fcmp instruction");
4790 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4792 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4794 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4795 if (yyval.InstVal == 0)
4796 GEN_ERROR("fcmp operator returned null");
4797 delete yyvsp[-3].TypeVal;
4801 #line 2861 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4803 if (!UpRefs.empty())
4804 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4805 Value* Val = yyvsp[-2].ValueVal;
4806 const Type* DestTy = yyvsp[0].TypeVal->get();
4807 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4808 GEN_ERROR("invalid cast opcode for cast from '" +
4809 Val->getType()->getDescription() + "' to '" +
4810 DestTy->getDescription() + "'");
4811 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4812 delete yyvsp[0].TypeVal;
4816 #line 2873 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4818 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4819 GEN_ERROR("select condition must be boolean");
4820 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4821 GEN_ERROR("select value types should match");
4822 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4827 #line 2881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4829 if (!UpRefs.empty())
4830 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4831 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4832 delete yyvsp[0].TypeVal;
4837 #line 2888 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4839 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4840 GEN_ERROR("Invalid extractelement operands");
4841 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4846 #line 2894 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4848 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4849 GEN_ERROR("Invalid insertelement operands");
4850 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4855 #line 2900 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4857 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4858 GEN_ERROR("Invalid shufflevector operands");
4859 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4864 #line 2906 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4866 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4867 if (!Ty->isFirstClassType())
4868 GEN_ERROR("PHI node operands must be of first class type");
4869 yyval.InstVal = new PHINode(Ty);
4870 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4871 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4872 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4873 GEN_ERROR("All elements of a PHI node must be of the same type");
4874 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4875 yyvsp[0].PHIList->pop_front();
4877 delete yyvsp[0].PHIList; // Free the list...
4882 #line 2922 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4885 // Handle the short syntax
4886 const PointerType *PFTy = 0;
4887 const FunctionType *Ty = 0;
4888 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
4889 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4890 // Pull out the types of all of the arguments...
4891 std::vector<const Type*> ParamTypes;
4892 ParamAttrsVector Attrs;
4893 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4894 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
4895 Attrs.push_back(PAWI);
4898 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
4899 for (; I != E; ++I, ++index) {
4900 const Type *Ty = I->Val->getType();
4901 if (Ty == Type::VoidTy)
4902 GEN_ERROR("Short call syntax cannot be used with varargs");
4903 ParamTypes.push_back(Ty);
4904 if (I->Attrs != ParamAttr::None) {
4905 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4906 Attrs.push_back(PAWI);
4910 ParamAttrsList *PAL = 0;
4912 PAL = ParamAttrsList::get(Attrs);
4914 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
4915 PFTy = PointerType::get(Ty);
4918 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
4921 // Check for call to invalid intrinsic to avoid crashing later.
4922 if (Function *theF = dyn_cast<Function>(V)) {
4923 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4924 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4925 !theF->getIntrinsicID(true))
4926 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4927 theF->getName() + "'");
4930 // Check the arguments
4932 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
4933 // Make sure no arguments is a good thing!
4934 if (Ty->getNumParams() != 0)
4935 GEN_ERROR("No arguments passed to a function that "
4936 "expects arguments");
4937 } else { // Has arguments?
4938 // Loop through FunctionType's arguments and ensure they are specified
4941 FunctionType::param_iterator I = Ty->param_begin();
4942 FunctionType::param_iterator E = Ty->param_end();
4943 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
4945 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4946 if (ArgI->Val->getType() != *I)
4947 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4948 (*I)->getDescription() + "'");
4949 Args.push_back(ArgI->Val);
4951 if (Ty->isVarArg()) {
4953 for (; ArgI != ArgE; ++ArgI)
4954 Args.push_back(ArgI->Val); // push the remaining varargs
4955 } else if (I != E || ArgI != ArgE)
4956 GEN_ERROR("Invalid number of parameters detected");
4958 // Create the call node
4959 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
4960 CI->setTailCall(yyvsp[-7].BoolVal);
4961 CI->setCallingConv(yyvsp[-6].UIntVal);
4963 delete yyvsp[-2].ValueRefList;
4964 delete yyvsp[-5].TypeVal;
4969 #line 3006 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4971 yyval.InstVal = yyvsp[0].InstVal;
4976 #line 3011 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4978 yyval.BoolVal = true;
4983 #line 3015 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4985 yyval.BoolVal = false;
4990 #line 3022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4992 if (!UpRefs.empty())
4993 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4994 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4995 delete yyvsp[-1].TypeVal;
5000 #line 3029 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5002 if (!UpRefs.empty())
5003 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5004 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5006 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5007 delete yyvsp[-4].TypeVal;
5011 #line 3037 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5013 if (!UpRefs.empty())
5014 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5015 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5016 delete yyvsp[-1].TypeVal;
5021 #line 3044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5023 if (!UpRefs.empty())
5024 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5025 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5027 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5028 delete yyvsp[-4].TypeVal;
5032 #line 3052 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5034 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5035 GEN_ERROR("Trying to free nonpointer type " +
5036 yyvsp[0].ValueVal->getType()->getDescription() + "");
5037 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5042 #line 3060 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5044 if (!UpRefs.empty())
5045 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5046 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5047 GEN_ERROR("Can't load from nonpointer type: " +
5048 (*yyvsp[-2].TypeVal)->getDescription());
5049 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5050 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5051 (*yyvsp[-2].TypeVal)->getDescription());
5052 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5054 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5055 delete yyvsp[-2].TypeVal;
5059 #line 3074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5061 if (!UpRefs.empty())
5062 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5063 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5065 GEN_ERROR("Can't store to a nonpointer type: " +
5066 (*yyvsp[-2].TypeVal)->getDescription());
5067 const Type *ElTy = PT->getElementType();
5068 if (ElTy != yyvsp[-4].ValueVal->getType())
5069 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5070 "' into space of type '" + ElTy->getDescription() + "'");
5072 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5074 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5075 delete yyvsp[-2].TypeVal;
5079 #line 3091 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5081 if (!UpRefs.empty())
5082 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5083 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5084 GEN_ERROR("getelementptr insn requires pointer operand");
5086 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
5087 GEN_ERROR("Invalid getelementptr indices for type '" +
5088 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5089 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5091 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
5092 delete yyvsp[-2].TypeVal;
5093 delete yyvsp[0].ValueList;
5097 /* the action file gets copied in in place of this dollarsign */
5098 #line 543 "/usr/share/bison.simple"
5109 short *ssp1 = yyss - 1;
5110 fprintf (stderr, "state stack now");
5111 while (ssp1 != yyssp)
5112 fprintf (stderr, " %d", *++ssp1);
5113 fprintf (stderr, "\n");
5123 yylsp->first_line = yylloc.first_line;
5124 yylsp->first_column = yylloc.first_column;
5125 yylsp->last_line = (yylsp-1)->last_line;
5126 yylsp->last_column = (yylsp-1)->last_column;
5131 yylsp->last_line = (yylsp+yylen-1)->last_line;
5132 yylsp->last_column = (yylsp+yylen-1)->last_column;
5136 /* Now "shift" the result of the reduction.
5137 Determine what state that goes to,
5138 based on the state we popped back to
5139 and the rule number reduced by. */
5143 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5144 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5145 yystate = yytable[yystate];
5147 yystate = yydefgoto[yyn - YYNTBASE];
5151 yyerrlab: /* here on detecting error */
5154 /* If not already recovering from an error, report this error. */
5158 #ifdef YYERROR_VERBOSE
5159 yyn = yypact[yystate];
5161 if (yyn > YYFLAG && yyn < YYLAST)
5168 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5169 for (x = (yyn < 0 ? -yyn : 0);
5170 x < (sizeof(yytname) / sizeof(char *)); x++)
5171 if (yycheck[x + yyn] == x)
5172 size += strlen(yytname[x]) + 15, count++;
5173 msg = (char *) malloc(size + 15);
5176 strcpy(msg, "parse error");
5181 for (x = (yyn < 0 ? -yyn : 0);
5182 x < (sizeof(yytname) / sizeof(char *)); x++)
5183 if (yycheck[x + yyn] == x)
5185 strcat(msg, count == 0 ? ", expecting `" : " or `");
5186 strcat(msg, yytname[x]);
5195 yyerror ("parse error; also virtual memory exceeded");
5198 #endif /* YYERROR_VERBOSE */
5199 yyerror("parse error");
5203 yyerrlab1: /* here on error raised explicitly by an action */
5205 if (yyerrstatus == 3)
5207 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5209 /* return failure if at end of input */
5210 if (yychar == YYEOF)
5215 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5221 /* Else will try to reuse lookahead token
5222 after shifting the error token. */
5224 yyerrstatus = 3; /* Each real token shifted decrements this */
5228 yyerrdefault: /* current state does not do anything special for the error token. */
5231 /* This is wrong; only states that explicitly want error tokens
5232 should shift them. */
5233 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5234 if (yyn) goto yydefault;
5237 yyerrpop: /* pop the current state because it cannot handle the error token */
5239 if (yyssp == yyss) YYABORT;
5249 short *ssp1 = yyss - 1;
5250 fprintf (stderr, "Error: state stack now");
5251 while (ssp1 != yyssp)
5252 fprintf (stderr, " %d", *++ssp1);
5253 fprintf (stderr, "\n");
5259 yyn = yypact[yystate];
5264 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5283 fprintf(stderr, "Shifting error token, ");
5295 /* YYACCEPT comes here. */
5307 /* YYABORT comes here. */
5318 #line 3108 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5321 // common code from the two 'RunVMAsmParser' functions
5322 static Module* RunParser(Module * M) {
5324 llvmAsmlineno = 1; // Reset the current line number...
5325 CurModule.CurrentModule = M;
5330 // Check to make sure the parser succeeded
5333 delete ParserResult;
5337 // Emit an error if there are any unresolved types left.
5338 if (!CurModule.LateResolveTypes.empty()) {
5339 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5340 if (DID.Type == ValID::LocalName) {
5341 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5343 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5346 delete ParserResult;
5350 // Emit an error if there are any unresolved values left.
5351 if (!CurModule.LateResolveValues.empty()) {
5352 Value *V = CurModule.LateResolveValues.back();
5353 std::map<Value*, std::pair<ValID, int> >::iterator I =
5354 CurModule.PlaceHolderInfo.find(V);
5356 if (I != CurModule.PlaceHolderInfo.end()) {
5357 ValID &DID = I->second.first;
5358 if (DID.Type == ValID::LocalName) {
5359 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5361 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5364 delete ParserResult;
5369 // Check to make sure that parsing produced a result
5373 // Reset ParserResult variable while saving its value for the result.
5374 Module *Result = ParserResult;
5380 void llvm::GenerateError(const std::string &message, int LineNo) {
5381 if (LineNo == -1) LineNo = llvmAsmlineno;
5382 // TODO: column number in exception
5384 TheParseError->setError(CurFilename, message, LineNo);
5388 int yyerror(const char *ErrorMsg) {
5390 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5391 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5392 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5393 if (yychar != YYEMPTY && yychar != 0)
5394 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5396 GenerateError(errMsg);