2 /* A Bison parser, made from /Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse llvmAsmparse
8 #define yylex llvmAsmlex
9 #define yyerror llvmAsmerror
10 #define yylval llvmAsmlval
11 #define yychar llvmAsmchar
12 #define yydebug llvmAsmdebug
13 #define yynerrs llvmAsmnerrs
14 #define ESINT64VAL 257
15 #define EUINT64VAL 258
16 #define ESAPINTVAL 259
17 #define EUAPINTVAL 260
18 #define LOCALVAL_ID 261
19 #define GLOBALVAL_ID 262
33 #define STRINGCONSTANT 276
34 #define ATSTRINGCONSTANT 277
35 #define PCTSTRINGCONSTANT 278
36 #define ZEROINITIALIZER 279
48 #define THREAD_LOCAL 291
59 #define EXTERN_WEAK 302
70 #define SIDEEFFECT 313
73 #define FASTCC_TOK 316
74 #define COLDCC_TOK 317
75 #define X86_STDCALLCC_TOK 318
76 #define X86_FASTCALLCC_TOK 319
77 #define DATALAYOUT 320
83 #define UNREACHABLE 326
126 #define GETELEMENTPTR 369
142 #define EXTRACTELEMENT 385
143 #define INSERTELEMENT 386
144 #define SHUFFLEVECTOR 387
156 #define PROTECTED 399
158 #line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
160 #include "ParserInternals.h"
161 #include "llvm/CallingConv.h"
162 #include "llvm/InlineAsm.h"
163 #include "llvm/Instructions.h"
164 #include "llvm/Module.h"
165 #include "llvm/ValueSymbolTable.h"
166 #include "llvm/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 float and double FP constants
565 // as double. Fix this here. Long double does not need this.
566 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
568 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
569 return ConstantFP::get(Ty, *D.ConstPoolFP);
571 case ValID::ConstNullVal: // Is it a null value?
572 if (!isa<PointerType>(Ty)) {
573 GenerateError("Cannot create a a non pointer null");
576 return ConstantPointerNull::get(cast<PointerType>(Ty));
578 case ValID::ConstUndefVal: // Is it an undef value?
579 return UndefValue::get(Ty);
581 case ValID::ConstZeroVal: // Is it a zero value?
582 return Constant::getNullValue(Ty);
584 case ValID::ConstantVal: // Fully resolved constant?
585 if (D.ConstantValue->getType() != Ty) {
586 GenerateError("Constant expression type different from required type");
589 return D.ConstantValue;
591 case ValID::InlineAsmVal: { // Inline asm expression
592 const PointerType *PTy = dyn_cast<PointerType>(Ty);
593 const FunctionType *FTy =
594 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
595 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
596 GenerateError("Invalid type for asm constraint string");
599 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
600 D.IAD->HasSideEffects);
601 D.destroy(); // Free InlineAsmDescriptor.
605 assert(0 && "Unhandled case!");
609 assert(0 && "Unhandled case!");
613 // getVal - This function is identical to getExistingVal, except that if a
614 // value is not already defined, it "improvises" by creating a placeholder var
615 // that looks and acts just like the requested variable. When the value is
616 // defined later, all uses of the placeholder variable are replaced with the
619 static Value *getVal(const Type *Ty, const ValID &ID) {
620 if (Ty == Type::LabelTy) {
621 GenerateError("Cannot use a basic block here");
625 // See if the value has already been defined.
626 Value *V = getExistingVal(Ty, ID);
628 if (TriggerError) return 0;
630 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
631 GenerateError("Invalid use of a composite type");
635 // If we reached here, we referenced either a symbol that we don't know about
636 // or an id number that hasn't been read yet. We may be referencing something
637 // forward, so just create an entry to be resolved later and get to it...
640 case ValID::GlobalName:
641 case ValID::GlobalID: {
642 const PointerType *PTy = dyn_cast<PointerType>(Ty);
644 GenerateError("Invalid type for reference to global" );
647 const Type* ElTy = PTy->getElementType();
648 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
649 V = new Function(FTy, GlobalValue::ExternalLinkage);
651 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
655 V = new Argument(Ty);
658 // Remember where this forward reference came from. FIXME, shouldn't we try
659 // to recycle these things??
660 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
663 if (inFunctionScope())
664 InsertValue(V, CurFun.LateResolveValues);
666 InsertValue(V, CurModule.LateResolveValues);
670 /// defineBBVal - This is a definition of a new basic block with the specified
671 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
672 static BasicBlock *defineBBVal(const ValID &ID) {
673 assert(inFunctionScope() && "Can't get basic block at global scope!");
677 // First, see if this was forward referenced
679 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
680 if (BBI != CurFun.BBForwardRefs.end()) {
682 // The forward declaration could have been inserted anywhere in the
683 // function: insert it into the correct place now.
684 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
685 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
687 // We're about to erase the entry, save the key so we can clean it up.
688 ValID Tmp = BBI->first;
690 // Erase the forward ref from the map as its no longer "forward"
691 CurFun.BBForwardRefs.erase(ID);
693 // The key has been removed from the map but so we don't want to leave
694 // strdup'd memory around so destroy it too.
697 // If its a numbered definition, bump the number and set the BB value.
698 if (ID.Type == ValID::LocalID) {
699 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
707 // We haven't seen this BB before and its first mention is a definition.
708 // Just create it and return it.
709 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
710 BB = new BasicBlock(Name, CurFun.CurrentFunction);
711 if (ID.Type == ValID::LocalID) {
712 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
716 ID.destroy(); // Free strdup'd memory
720 /// getBBVal - get an existing BB value or create a forward reference for it.
722 static BasicBlock *getBBVal(const ValID &ID) {
723 assert(inFunctionScope() && "Can't get basic block at global scope!");
727 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
728 if (BBI != CurFun.BBForwardRefs.end()) {
730 } if (ID.Type == ValID::LocalName) {
731 std::string Name = ID.getName();
732 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
734 if (N->getType()->getTypeID() == Type::LabelTyID)
735 BB = cast<BasicBlock>(N);
737 GenerateError("Reference to label '" + Name + "' is actually of type '"+
738 N->getType()->getDescription() + "'");
739 } else if (ID.Type == ValID::LocalID) {
740 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
741 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
742 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
744 GenerateError("Reference to label '%" + utostr(ID.Num) +
745 "' is actually of type '"+
746 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
749 GenerateError("Illegal label reference " + ID.getName());
753 // If its already been defined, return it now.
755 ID.destroy(); // Free strdup'd memory.
759 // Otherwise, this block has not been seen before, create it.
761 if (ID.Type == ValID::LocalName)
763 BB = new BasicBlock(Name, CurFun.CurrentFunction);
765 // Insert it in the forward refs map.
766 CurFun.BBForwardRefs[ID] = BB;
772 //===----------------------------------------------------------------------===//
773 // Code to handle forward references in instructions
774 //===----------------------------------------------------------------------===//
776 // This code handles the late binding needed with statements that reference
777 // values not defined yet... for example, a forward branch, or the PHI node for
780 // This keeps a table (CurFun.LateResolveValues) of all such forward references
781 // and back patchs after we are done.
784 // ResolveDefinitions - If we could not resolve some defs at parsing
785 // time (forward branches, phi functions for loops, etc...) resolve the
789 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
790 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
791 while (!LateResolvers.empty()) {
792 Value *V = LateResolvers.back();
793 LateResolvers.pop_back();
795 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
796 CurModule.PlaceHolderInfo.find(V);
797 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
799 ValID &DID = PHI->second.first;
801 Value *TheRealValue = getExistingVal(V->getType(), DID);
805 V->replaceAllUsesWith(TheRealValue);
807 CurModule.PlaceHolderInfo.erase(PHI);
808 } else if (FutureLateResolvers) {
809 // Functions have their unresolved items forwarded to the module late
811 InsertValue(V, *FutureLateResolvers);
813 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
814 GenerateError("Reference to an invalid definition: '" +DID.getName()+
815 "' of type '" + V->getType()->getDescription() + "'",
819 GenerateError("Reference to an invalid definition: #" +
820 itostr(DID.Num) + " of type '" +
821 V->getType()->getDescription() + "'",
827 LateResolvers.clear();
830 // ResolveTypeTo - A brand new type was just declared. This means that (if
831 // name is not null) things referencing Name can be resolved. Otherwise, things
832 // refering to the number can be resolved. Do this now.
834 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
837 D = ValID::createLocalName(*Name);
839 D = ValID::createLocalID(CurModule.Types.size());
841 std::map<ValID, PATypeHolder>::iterator I =
842 CurModule.LateResolveTypes.find(D);
843 if (I != CurModule.LateResolveTypes.end()) {
844 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
845 CurModule.LateResolveTypes.erase(I);
849 // setValueName - Set the specified value to the name given. The name may be
850 // null potentially, in which case this is a noop. The string passed in is
851 // assumed to be a malloc'd string buffer, and is free'd by this function.
853 static void setValueName(Value *V, std::string *NameStr) {
854 if (!NameStr) return;
855 std::string Name(*NameStr); // Copy string
856 delete NameStr; // Free old string
858 if (V->getType() == Type::VoidTy) {
859 GenerateError("Can't assign name '" + Name+"' to value with void type");
863 assert(inFunctionScope() && "Must be in function scope!");
864 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
865 if (ST.lookup(Name)) {
866 GenerateError("Redefinition of value '" + Name + "' of type '" +
867 V->getType()->getDescription() + "'");
875 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
876 /// this is a declaration, otherwise it is a definition.
877 static GlobalVariable *
878 ParseGlobalVariable(std::string *NameStr,
879 GlobalValue::LinkageTypes Linkage,
880 GlobalValue::VisibilityTypes Visibility,
881 bool isConstantGlobal, const Type *Ty,
882 Constant *Initializer, bool IsThreadLocal) {
883 if (isa<FunctionType>(Ty)) {
884 GenerateError("Cannot declare global vars of function type");
888 const PointerType *PTy = PointerType::get(Ty);
892 Name = *NameStr; // Copy string
893 delete NameStr; // Free old string
896 // See if this global value was forward referenced. If so, recycle the
900 ID = ValID::createGlobalName(Name);
902 ID = ValID::createGlobalID(CurModule.Values.size());
905 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
906 // Move the global to the end of the list, from whereever it was
907 // previously inserted.
908 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
909 CurModule.CurrentModule->getGlobalList().remove(GV);
910 CurModule.CurrentModule->getGlobalList().push_back(GV);
911 GV->setInitializer(Initializer);
912 GV->setLinkage(Linkage);
913 GV->setVisibility(Visibility);
914 GV->setConstant(isConstantGlobal);
915 GV->setThreadLocal(IsThreadLocal);
916 InsertValue(GV, CurModule.Values);
920 // If this global has a name
922 // if the global we're parsing has an initializer (is a definition) and
923 // has external linkage.
924 if (Initializer && Linkage != GlobalValue::InternalLinkage)
925 // If there is already a global with external linkage with this name
926 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
927 // If we allow this GVar to get created, it will be renamed in the
928 // symbol table because it conflicts with an existing GVar. We can't
929 // allow redefinition of GVars whose linking indicates that their name
930 // must stay the same. Issue the error.
931 GenerateError("Redefinition of global variable named '" + Name +
932 "' of type '" + Ty->getDescription() + "'");
937 // Otherwise there is no existing GV to use, create one now.
939 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
940 CurModule.CurrentModule, IsThreadLocal);
941 GV->setVisibility(Visibility);
942 InsertValue(GV, CurModule.Values);
946 // setTypeName - Set the specified type to the name given. The name may be
947 // null potentially, in which case this is a noop. The string passed in is
948 // assumed to be a malloc'd string buffer, and is freed by this function.
950 // This function returns true if the type has already been defined, but is
951 // allowed to be redefined in the specified context. If the name is a new name
952 // for the type plane, it is inserted and false is returned.
953 static bool setTypeName(const Type *T, std::string *NameStr) {
954 assert(!inFunctionScope() && "Can't give types function-local names!");
955 if (NameStr == 0) return false;
957 std::string Name(*NameStr); // Copy string
958 delete NameStr; // Free old string
960 // We don't allow assigning names to void type
961 if (T == Type::VoidTy) {
962 GenerateError("Can't assign name '" + Name + "' to the void type");
966 // Set the type name, checking for conflicts as we do so.
967 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
969 if (AlreadyExists) { // Inserting a name that is already defined???
970 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
971 assert(Existing && "Conflict but no matching type?!");
973 // There is only one case where this is allowed: when we are refining an
974 // opaque type. In this case, Existing will be an opaque type.
975 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
976 // We ARE replacing an opaque type!
977 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
981 // Otherwise, this is an attempt to redefine a type. That's okay if
982 // the redefinition is identical to the original. This will be so if
983 // Existing and T point to the same Type object. In this one case we
984 // allow the equivalent redefinition.
985 if (Existing == T) return true; // Yes, it's equal.
987 // Any other kind of (non-equivalent) redefinition is an error.
988 GenerateError("Redefinition of type named '" + Name + "' of type '" +
989 T->getDescription() + "'");
995 //===----------------------------------------------------------------------===//
996 // Code for handling upreferences in type names...
999 // TypeContains - Returns true if Ty directly contains E in it.
1001 static bool TypeContains(const Type *Ty, const Type *E) {
1002 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1003 E) != Ty->subtype_end();
1007 struct UpRefRecord {
1008 // NestingLevel - The number of nesting levels that need to be popped before
1009 // this type is resolved.
1010 unsigned NestingLevel;
1012 // LastContainedTy - This is the type at the current binding level for the
1013 // type. Every time we reduce the nesting level, this gets updated.
1014 const Type *LastContainedTy;
1016 // UpRefTy - This is the actual opaque type that the upreference is
1017 // represented with.
1018 OpaqueType *UpRefTy;
1020 UpRefRecord(unsigned NL, OpaqueType *URTy)
1021 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1025 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1026 static std::vector<UpRefRecord> UpRefs;
1028 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1029 /// called. It loops through the UpRefs vector, which is a list of the
1030 /// currently active types. For each type, if the up reference is contained in
1031 /// the newly completed type, we decrement the level count. When the level
1032 /// count reaches zero, the upreferenced type is the type that is passed in:
1033 /// thus we can complete the cycle.
1035 static PATypeHolder HandleUpRefs(const Type *ty) {
1036 // If Ty isn't abstract, or if there are no up-references in it, then there is
1037 // nothing to resolve here.
1038 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1040 PATypeHolder Ty(ty);
1041 UR_OUT("Type '" << Ty->getDescription() <<
1042 "' newly formed. Resolving upreferences.\n" <<
1043 UpRefs.size() << " upreferences active!\n");
1045 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1046 // to zero), we resolve them all together before we resolve them to Ty. At
1047 // the end of the loop, if there is anything to resolve to Ty, it will be in
1049 OpaqueType *TypeToResolve = 0;
1051 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1052 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1053 << UpRefs[i].second->getDescription() << ") = "
1054 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1055 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1056 // Decrement level of upreference
1057 unsigned Level = --UpRefs[i].NestingLevel;
1058 UpRefs[i].LastContainedTy = Ty;
1059 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1060 if (Level == 0) { // Upreference should be resolved!
1061 if (!TypeToResolve) {
1062 TypeToResolve = UpRefs[i].UpRefTy;
1064 UR_OUT(" * Resolving upreference for "
1065 << UpRefs[i].second->getDescription() << "\n";
1066 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1067 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1068 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1069 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1071 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1072 --i; // Do not skip the next element...
1077 if (TypeToResolve) {
1078 UR_OUT(" * Resolving upreference for "
1079 << UpRefs[i].second->getDescription() << "\n";
1080 std::string OldName = TypeToResolve->getDescription());
1081 TypeToResolve->refineAbstractTypeTo(Ty);
1087 //===----------------------------------------------------------------------===//
1088 // RunVMAsmParser - Define an interface to this parser
1089 //===----------------------------------------------------------------------===//
1091 static Module* RunParser(Module * M);
1093 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1096 CurFilename = Filename;
1097 return RunParser(new Module(CurFilename));
1100 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1101 set_scan_string(AsmString);
1103 CurFilename = "from_memory";
1105 return RunParser(new Module (CurFilename));
1107 return RunParser(M);
1112 #line 968 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
1114 llvm::Module *ModuleVal;
1115 llvm::Function *FunctionVal;
1116 llvm::BasicBlock *BasicBlockVal;
1117 llvm::TerminatorInst *TermInstVal;
1118 llvm::Instruction *InstVal;
1119 llvm::Constant *ConstVal;
1121 const llvm::Type *PrimType;
1122 std::list<llvm::PATypeHolder> *TypeList;
1123 llvm::PATypeHolder *TypeVal;
1124 llvm::Value *ValueVal;
1125 std::vector<llvm::Value*> *ValueList;
1126 llvm::ArgListType *ArgList;
1127 llvm::TypeWithAttrs TypeWithAttrs;
1128 llvm::TypeWithAttrsList *TypeWithAttrsList;
1129 llvm::ValueRefList *ValueRefList;
1131 // Represent the RHS of PHI node
1132 std::list<std::pair<llvm::Value*,
1133 llvm::BasicBlock*> > *PHIList;
1134 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1135 std::vector<llvm::Constant*> *ConstVector;
1137 llvm::GlobalValue::LinkageTypes Linkage;
1138 llvm::GlobalValue::VisibilityTypes Visibility;
1139 uint16_t ParamAttrs;
1140 llvm::APInt *APIntVal;
1145 llvm::APFloat *FPVal;
1148 std::string *StrVal; // This memory must be deleted
1149 llvm::ValID ValIDVal;
1151 llvm::Instruction::BinaryOps BinaryOpVal;
1152 llvm::Instruction::TermOps TermOpVal;
1153 llvm::Instruction::MemoryOps MemOpVal;
1154 llvm::Instruction::CastOps CastOpVal;
1155 llvm::Instruction::OtherOps OtherOpVal;
1156 llvm::ICmpInst::Predicate IPredicate;
1157 llvm::FCmpInst::Predicate FPredicate;
1170 #define YYFLAG -32768
1171 #define YYNTBASE 160
1173 #define YYTRANSLATE(x) ((unsigned)(x) <= 399 ? yytranslate[x] : 241)
1175 static const short yytranslate[] = { 0,
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, 2,
1179 2, 2, 2, 2, 2, 2, 2, 2, 2, 150,
1180 151, 148, 2, 147, 2, 2, 2, 2, 2, 2,
1181 2, 2, 2, 2, 2, 2, 2, 2, 2, 155,
1182 146, 156, 2, 2, 2, 2, 2, 2, 2, 2,
1183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1185 152, 149, 154, 2, 2, 2, 2, 2, 159, 2,
1186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1187 2, 2, 2, 2, 2, 2, 2, 2, 2, 153,
1188 2, 2, 157, 2, 158, 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, 2, 2, 2, 2, 2,
1201 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1202 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1203 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1204 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1205 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1206 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1207 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1208 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1209 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1210 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1211 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1212 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1213 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1214 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1215 137, 138, 139, 140, 141, 142, 143, 144, 145
1219 static const short yyprhs[] = { 0,
1220 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1221 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1222 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1223 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1224 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1225 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1226 120, 122, 124, 126, 127, 130, 131, 133, 135, 137,
1227 138, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1228 158, 160, 162, 164, 165, 167, 169, 170, 172, 174,
1229 176, 178, 179, 181, 183, 184, 186, 188, 190, 192,
1230 194, 197, 199, 201, 203, 205, 207, 209, 211, 213,
1231 215, 216, 219, 221, 223, 225, 227, 228, 231, 232,
1232 235, 236, 240, 243, 244, 246, 247, 251, 253, 256,
1233 258, 260, 262, 264, 266, 268, 270, 272, 274, 277,
1234 279, 282, 288, 294, 300, 306, 310, 313, 319, 324,
1235 327, 329, 331, 333, 337, 339, 343, 345, 346, 348,
1236 352, 357, 361, 365, 370, 375, 379, 386, 392, 395,
1237 398, 401, 404, 407, 410, 413, 416, 419, 422, 425,
1238 428, 435, 441, 450, 457, 464, 472, 480, 487, 496,
1239 505, 509, 511, 513, 515, 517, 518, 521, 528, 530,
1240 531, 533, 536, 537, 541, 542, 546, 550, 554, 558,
1241 559, 567, 568, 577, 578, 587, 593, 596, 600, 602,
1242 606, 610, 614, 618, 620, 621, 627, 631, 633, 637,
1243 639, 640, 650, 652, 654, 659, 661, 663, 666, 670,
1244 671, 673, 675, 677, 679, 681, 683, 685, 687, 689,
1245 693, 695, 701, 703, 705, 707, 709, 711, 713, 716,
1246 719, 722, 726, 729, 730, 732, 735, 738, 742, 752,
1247 762, 771, 786, 788, 790, 797, 803, 806, 813, 821,
1248 825, 831, 832, 833, 837, 840, 842, 848, 854, 861,
1249 868, 873, 880, 885, 890, 897, 904, 907, 916, 918,
1250 920, 921, 925, 932, 936, 943, 946, 952, 960
1253 static const short yyrhs[] = { 73,
1254 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1255 0, 79, 0, 80, 0, 81, 0, 85, 0, 86,
1256 0, 87, 0, 82, 0, 83, 0, 84, 0, 116,
1257 0, 117, 0, 118, 0, 119, 0, 120, 0, 121,
1258 0, 122, 0, 123, 0, 124, 0, 125, 0, 126,
1259 0, 127, 0, 90, 0, 91, 0, 92, 0, 93,
1260 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
1261 0, 99, 0, 100, 0, 101, 0, 102, 0, 103,
1262 0, 104, 0, 105, 0, 106, 0, 107, 0, 108,
1263 0, 109, 0, 96, 0, 97, 0, 98, 0, 99,
1264 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1265 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1266 0, 24, 0, 167, 0, 0, 167, 146, 0, 0,
1267 20, 0, 23, 0, 172, 0, 0, 170, 146, 0,
1268 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1269 46, 0, 48, 0, 50, 0, 0, 143, 0, 144,
1270 0, 145, 0, 0, 46, 0, 48, 0, 0, 42,
1271 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1272 42, 0, 0, 61, 0, 62, 0, 63, 0, 64,
1273 0, 65, 0, 60, 4, 0, 135, 0, 117, 0,
1274 134, 0, 118, 0, 137, 0, 138, 0, 140, 0,
1275 141, 0, 142, 0, 0, 181, 180, 0, 136, 0,
1276 139, 0, 135, 0, 134, 0, 0, 183, 182, 0,
1277 0, 53, 4, 0, 0, 147, 53, 4, 0, 34,
1278 22, 0, 0, 186, 0, 0, 147, 189, 188, 0,
1279 186, 0, 53, 4, 0, 11, 0, 12, 0, 13,
1280 0, 16, 0, 15, 0, 14, 0, 17, 0, 49,
1281 0, 190, 0, 191, 148, 0, 225, 0, 149, 4,
1282 0, 191, 150, 195, 151, 183, 0, 10, 150, 195,
1283 151, 183, 0, 152, 4, 153, 191, 154, 0, 155,
1284 4, 153, 191, 156, 0, 157, 196, 158, 0, 157,
1285 158, 0, 155, 157, 196, 158, 156, 0, 155, 157,
1286 158, 156, 0, 191, 181, 0, 191, 0, 10, 0,
1287 192, 0, 194, 147, 192, 0, 194, 0, 194, 147,
1288 39, 0, 39, 0, 0, 191, 0, 196, 147, 191,
1289 0, 191, 152, 199, 154, 0, 191, 152, 154, 0,
1290 191, 159, 22, 0, 191, 155, 199, 156, 0, 191,
1291 157, 199, 158, 0, 191, 157, 158, 0, 191, 155,
1292 157, 199, 158, 156, 0, 191, 155, 157, 158, 156,
1293 0, 191, 40, 0, 191, 41, 0, 191, 225, 0,
1294 191, 198, 0, 191, 25, 0, 165, 3, 0, 165,
1295 5, 0, 165, 4, 0, 165, 6, 0, 11, 26,
1296 0, 11, 27, 0, 166, 9, 0, 162, 150, 197,
1297 38, 191, 151, 0, 115, 150, 197, 236, 151, 0,
1298 129, 150, 197, 147, 197, 147, 197, 151, 0, 160,
1299 150, 197, 147, 197, 151, 0, 161, 150, 197, 147,
1300 197, 151, 0, 88, 163, 150, 197, 147, 197, 151,
1301 0, 89, 164, 150, 197, 147, 197, 151, 0, 131,
1302 150, 197, 147, 197, 151, 0, 132, 150, 197, 147,
1303 197, 147, 197, 151, 0, 133, 150, 197, 147, 197,
1304 147, 197, 151, 0, 199, 147, 197, 0, 197, 0,
1305 32, 0, 33, 0, 37, 0, 0, 193, 225, 0,
1306 121, 150, 202, 38, 191, 151, 0, 204, 0, 0,
1307 205, 0, 204, 205, 0, 0, 31, 206, 221, 0,
1308 0, 30, 207, 222, 0, 58, 57, 211, 0, 169,
1309 18, 191, 0, 169, 18, 10, 0, 0, 171, 175,
1310 201, 200, 197, 208, 188, 0, 0, 171, 173, 175,
1311 201, 200, 197, 209, 188, 0, 0, 171, 174, 175,
1312 201, 200, 191, 210, 188, 0, 171, 175, 35, 178,
1313 202, 0, 51, 212, 0, 54, 146, 213, 0, 22,
1314 0, 52, 146, 22, 0, 66, 146, 22, 0, 152,
1315 214, 154, 0, 214, 147, 22, 0, 22, 0, 0,
1316 215, 147, 191, 181, 168, 0, 191, 181, 168, 0,
1317 215, 0, 215, 147, 39, 0, 39, 0, 0, 179,
1318 193, 170, 150, 216, 151, 183, 187, 184, 0, 28,
1319 0, 157, 0, 177, 175, 217, 218, 0, 29, 0,
1320 158, 0, 228, 220, 0, 176, 175, 217, 0, 0,
1321 59, 0, 3, 0, 4, 0, 9, 0, 26, 0,
1322 27, 0, 40, 0, 41, 0, 25, 0, 155, 199,
1323 156, 0, 198, 0, 57, 223, 22, 147, 22, 0,
1324 7, 0, 8, 0, 167, 0, 170, 0, 225, 0,
1325 224, 0, 191, 226, 0, 228, 229, 0, 219, 229,
1326 0, 230, 169, 231, 0, 230, 233, 0, 0, 21,
1327 0, 67, 227, 0, 67, 10, 0, 68, 17, 226,
1328 0, 68, 11, 226, 147, 17, 226, 147, 17, 226,
1329 0, 69, 165, 226, 147, 17, 226, 152, 232, 154,
1330 0, 69, 165, 226, 147, 17, 226, 152, 154, 0,
1331 70, 179, 193, 226, 150, 235, 151, 183, 38, 17,
1332 226, 71, 17, 226, 0, 71, 0, 72, 0, 232,
1333 165, 224, 147, 17, 226, 0, 165, 224, 147, 17,
1334 226, 0, 169, 238, 0, 191, 152, 226, 147, 226,
1335 154, 0, 234, 147, 152, 226, 147, 226, 154, 0,
1336 191, 226, 181, 0, 235, 147, 191, 226, 181, 0,
1337 0, 0, 236, 147, 227, 0, 56, 55, 0, 55,
1338 0, 160, 191, 226, 147, 226, 0, 161, 191, 226,
1339 147, 226, 0, 88, 163, 191, 226, 147, 226, 0,
1340 89, 164, 191, 226, 147, 226, 0, 162, 227, 38,
1341 191, 0, 129, 227, 147, 227, 147, 227, 0, 130,
1342 227, 147, 191, 0, 131, 227, 147, 227, 0, 132,
1343 227, 147, 227, 147, 227, 0, 133, 227, 147, 227,
1344 147, 227, 0, 128, 234, 0, 237, 179, 193, 226,
1345 150, 235, 151, 183, 0, 240, 0, 36, 0, 0,
1346 110, 191, 185, 0, 110, 191, 147, 11, 226, 185,
1347 0, 111, 191, 185, 0, 111, 191, 147, 11, 226,
1348 185, 0, 112, 227, 0, 239, 113, 191, 226, 185,
1349 0, 239, 114, 227, 147, 191, 226, 185, 0, 115,
1356 static const short yyrline[] = { 0,
1357 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1128,
1358 1128, 1128, 1128, 1128, 1128, 1129, 1129, 1129, 1129, 1129,
1359 1129, 1129, 1130, 1130, 1130, 1130, 1130, 1133, 1133, 1134,
1360 1134, 1135, 1135, 1136, 1136, 1137, 1137, 1141, 1141, 1142,
1361 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1147,
1362 1147, 1148, 1149, 1154, 1155, 1155, 1155, 1155, 1155, 1157,
1363 1157, 1157, 1158, 1158, 1162, 1166, 1171, 1171, 1173, 1174,
1364 1179, 1185, 1186, 1187, 1188, 1189, 1193, 1194, 1195, 1199,
1365 1200, 1201, 1202, 1206, 1207, 1208, 1212, 1213, 1214, 1215,
1366 1216, 1220, 1221, 1222, 1225, 1225, 1226, 1227, 1228, 1229,
1367 1230, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246,
1368 1249, 1250, 1255, 1256, 1257, 1258, 1261, 1262, 1269, 1269,
1369 1276, 1276, 1285, 1293, 1293, 1299, 1299, 1301, 1306, 1319,
1370 1319, 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337,
1371 1342, 1350, 1380, 1411, 1416, 1428, 1438, 1442, 1452, 1459,
1372 1466, 1473, 1478, 1483, 1490, 1491, 1498, 1505, 1513, 1519,
1373 1531, 1559, 1575, 1602, 1630, 1656, 1676, 1702, 1722, 1734,
1374 1741, 1807, 1817, 1827, 1833, 1843, 1849, 1859, 1864, 1869,
1375 1882, 1894, 1916, 1924, 1930, 1941, 1946, 1951, 1957, 1963,
1376 1972, 1976, 1984, 1984, 1987, 1987, 1990, 2002, 2023, 2028,
1377 2036, 2037, 2041, 2041, 2045, 2045, 2048, 2051, 2075, 2086,
1378 2093, 2096, 2102, 2105, 2112, 2116, 2156, 2159, 2165, 2175,
1379 2179, 2184, 2186, 2191, 2196, 2205, 2215, 2226, 2230, 2239,
1380 2248, 2253, 2374, 2374, 2376, 2385, 2385, 2387, 2392, 2404,
1381 2408, 2413, 2417, 2421, 2425, 2429, 2433, 2437, 2441, 2445,
1382 2470, 2474, 2484, 2488, 2492, 2497, 2504, 2504, 2510, 2519,
1383 2523, 2532, 2541, 2550, 2554, 2561, 2565, 2569, 2574, 2584,
1384 2603, 2612, 2692, 2696, 2703, 2714, 2727, 2737, 2748, 2758,
1385 2767, 2776, 2779, 2780, 2787, 2791, 2796, 2817, 2834, 2848,
1386 2862, 2874, 2882, 2889, 2895, 2901, 2907, 2922, 3007, 3012,
1387 3016, 3023, 3030, 3038, 3045, 3053, 3061, 3075, 3092
1392 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1394 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1395 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1396 "VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1397 "LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1398 "ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1399 "GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1400 "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1401 "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL",
1402 "TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1403 "X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE",
1404 "UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM",
1405 "FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT",
1406 "SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD",
1407 "UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC",
1408 "ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI",
1409 "INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT",
1410 "SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET","NOUNWIND","NOALIAS",
1411 "BYVAL","NEST","DEFAULT","HIDDEN","PROTECTED","'='","','","'*'","'\\\\'","'('",
1412 "')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps",
1413 "CastOps","IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName",
1414 "OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage",
1415 "GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage",
1416 "AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs",
1417 "OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1418 "PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1419 "ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1420 "Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1421 "LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1422 "FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1423 "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1424 "BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","IndexList","OptTailCall",
1425 "InstVal","OptVolatile","MemoryInst", NULL
1429 static const short yyr1[] = { 0,
1430 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1431 161, 161, 161, 161, 161, 162, 162, 162, 162, 162,
1432 162, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1433 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
1434 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1435 164, 164, 164, 165, 166, 166, 166, 166, 166, 167,
1436 167, 167, 168, 168, 169, 169, 170, 170, 171, 171,
1437 172, 173, 173, 173, 173, 173, 174, 174, 174, 175,
1438 175, 175, 175, 176, 176, 176, 177, 177, 177, 177,
1439 177, 178, 178, 178, 179, 179, 179, 179, 179, 179,
1440 179, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1441 181, 181, 182, 182, 182, 182, 183, 183, 184, 184,
1442 185, 185, 186, 187, 187, 188, 188, 189, 189, 190,
1443 190, 190, 190, 190, 190, 190, 191, 191, 191, 191,
1444 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1445 193, 193, 194, 194, 195, 195, 195, 195, 196, 196,
1446 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1447 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1448 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1449 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1450 204, 204, 206, 205, 207, 205, 205, 205, 205, 208,
1451 205, 209, 205, 210, 205, 205, 205, 205, 211, 212,
1452 212, 213, 214, 214, 214, 215, 215, 216, 216, 216,
1453 216, 217, 218, 218, 219, 220, 220, 221, 222, 223,
1454 223, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1455 224, 224, 225, 225, 225, 225, 226, 226, 227, 228,
1456 228, 229, 230, 230, 230, 231, 231, 231, 231, 231,
1457 231, 231, 231, 231, 232, 232, 233, 234, 234, 235,
1458 235, 235, 236, 236, 237, 237, 238, 238, 238, 238,
1459 238, 238, 238, 238, 238, 238, 238, 238, 238, 239,
1460 239, 240, 240, 240, 240, 240, 240, 240, 240
1463 static const short yyr2[] = { 0,
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, 1, 1, 1, 1, 1, 1, 1,
1470 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1471 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1472 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1473 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1474 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1475 0, 2, 1, 1, 1, 1, 0, 2, 0, 2,
1476 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
1477 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1478 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1479 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1480 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1482 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1483 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1484 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1485 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1486 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1487 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1488 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1489 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1490 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1491 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1492 5, 0, 0, 3, 2, 1, 5, 5, 6, 6,
1493 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
1494 0, 3, 6, 3, 6, 2, 5, 7, 4
1497 static const short yydefact[] = { 70,
1498 60, 67, 61, 68, 62, 205, 203, 0, 0, 0,
1499 0, 0, 0, 80, 69, 70, 201, 84, 87, 0,
1500 0, 217, 0, 0, 65, 0, 71, 72, 74, 73,
1501 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1502 196, 202, 85, 86, 80, 206, 88, 89, 90, 91,
1503 80, 264, 204, 264, 0, 0, 225, 218, 219, 207,
1504 253, 254, 209, 130, 131, 132, 135, 134, 133, 136,
1505 137, 0, 0, 0, 0, 255, 256, 138, 208, 140,
1506 196, 196, 92, 195, 0, 95, 95, 265, 261, 66,
1507 236, 237, 238, 260, 220, 221, 224, 0, 158, 141,
1508 0, 0, 0, 0, 147, 159, 0, 139, 158, 0,
1509 0, 94, 93, 0, 193, 194, 0, 0, 96, 97,
1510 98, 99, 100, 0, 239, 0, 301, 263, 0, 222,
1511 157, 111, 153, 155, 0, 0, 0, 0, 0, 0,
1512 146, 0, 0, 0, 152, 0, 151, 0, 216, 130,
1513 131, 132, 135, 134, 133, 0, 0, 0, 210, 101,
1514 0, 233, 234, 235, 300, 286, 0, 0, 0, 0,
1515 95, 273, 274, 1, 2, 3, 4, 5, 6, 7,
1516 8, 9, 13, 14, 15, 10, 11, 12, 0, 0,
1517 0, 0, 0, 0, 16, 17, 18, 19, 20, 21,
1518 22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
1519 0, 0, 0, 0, 0, 262, 95, 277, 0, 299,
1520 223, 150, 0, 117, 0, 0, 149, 0, 160, 117,
1521 212, 214, 0, 197, 178, 179, 174, 176, 175, 177,
1522 180, 173, 169, 170, 0, 0, 0, 0, 0, 0,
1523 0, 0, 0, 0, 0, 0, 0, 0, 172, 171,
1524 126, 0, 285, 267, 0, 266, 0, 0, 54, 0,
1525 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1526 37, 0, 52, 53, 48, 49, 50, 51, 38, 39,
1527 40, 41, 42, 43, 44, 45, 46, 47, 0, 121,
1528 121, 306, 0, 0, 297, 0, 0, 0, 0, 0,
1529 0, 0, 0, 0, 0, 0, 103, 105, 104, 102,
1530 106, 107, 108, 109, 110, 112, 156, 154, 143, 144,
1531 145, 148, 142, 126, 126, 0, 0, 0, 0, 0,
1532 0, 0, 0, 162, 192, 0, 0, 0, 166, 0,
1533 163, 0, 0, 0, 0, 211, 231, 242, 243, 244,
1534 249, 245, 246, 247, 248, 240, 0, 251, 258, 257,
1535 259, 0, 268, 0, 0, 0, 0, 0, 302, 0,
1536 304, 283, 0, 0, 0, 0, 0, 0, 0, 0,
1537 0, 0, 0, 0, 0, 116, 115, 113, 114, 118,
1538 213, 215, 0, 0, 0, 283, 0, 0, 0, 0,
1539 0, 161, 147, 159, 0, 164, 165, 0, 0, 0,
1540 0, 0, 128, 126, 230, 111, 228, 0, 241, 0,
1541 0, 0, 0, 0, 0, 0, 0, 0, 0, 309,
1542 0, 0, 0, 293, 294, 0, 0, 0, 0, 291,
1543 0, 121, 0, 0, 0, 0, 0, 0, 0, 0,
1544 0, 191, 168, 0, 0, 0, 0, 123, 129, 127,
1545 64, 0, 117, 0, 250, 0, 0, 282, 0, 0,
1546 121, 122, 121, 0, 0, 0, 0, 0, 0, 287,
1547 288, 282, 0, 307, 0, 198, 0, 0, 182, 0,
1548 0, 0, 0, 167, 0, 0, 0, 63, 227, 229,
1549 111, 124, 0, 0, 0, 0, 0, 289, 290, 303,
1550 305, 284, 0, 0, 292, 295, 296, 0, 121, 0,
1551 0, 0, 188, 0, 0, 184, 185, 181, 64, 125,
1552 119, 252, 0, 0, 111, 0, 117, 278, 0, 117,
1553 308, 186, 187, 0, 0, 0, 226, 0, 232, 0,
1554 271, 0, 0, 280, 0, 0, 279, 298, 183, 189,
1555 190, 120, 269, 0, 270, 0, 111, 0, 0, 0,
1556 281, 0, 0, 0, 0, 276, 0, 0, 275, 0,
1560 static const short yydefgoto[] = { 256,
1561 257, 258, 282, 299, 156, 157, 76, 509, 12, 77,
1562 14, 15, 39, 40, 41, 45, 51, 114, 124, 326,
1563 222, 400, 329, 559, 379, 423, 541, 356, 424, 78,
1564 158, 133, 148, 134, 135, 107, 345, 368, 346, 117,
1565 85, 149, 592, 16, 17, 19, 18, 261, 334, 335,
1566 60, 22, 58, 98, 427, 428, 125, 164, 52, 93,
1567 53, 46, 430, 369, 80, 371, 266, 54, 89, 90,
1568 216, 563, 128, 305, 517, 440, 217, 218, 219, 220
1571 static const short yypact[] = { 42,
1572 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -21, -131, 60,
1573 -93, 105, -22, 182,-32768, 525,-32768, 46, 168, -12,
1574 19,-32768, 1, 152,-32768, 1277,-32768,-32768,-32768,-32768,
1575 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 90, 90,
1576 100,-32768,-32768,-32768, 90,-32768,-32768,-32768,-32768,-32768,
1577 90, 186,-32768, 12, 187, 201, 209,-32768,-32768,-32768,
1578 -32768,-32768, 93,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1579 -32768, 252, 254, 2, 907,-32768,-32768,-32768, 13,-32768,
1580 225, 225, 150,-32768, 76, 116, 116,-32768,-32768, 108,
1581 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -79, 1027,-32768,
1582 111, 114, 947, 93,-32768, 13, -104,-32768, 1027, 76,
1583 76,-32768,-32768, 1067,-32768,-32768, 1299, 266,-32768,-32768,
1584 -32768,-32768,-32768, 1330,-32768, -16, 1572,-32768, 256,-32768,
1585 -32768, 13,-32768, 139, 144, 1370, 1370, 132, -95, 1370,
1586 -32768, 145, 1299, 1370, 93, 147, 13, 311,-32768, 43,
1587 290, 293, 298, 299, 302, 247, 303, 724,-32768,-32768,
1588 35,-32768,-32768,-32768,-32768,-32768, 258, 1450, 70, 305,
1589 116,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1590 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 317, 405,
1591 1370, 1370, 1370, 1370,-32768,-32768,-32768,-32768,-32768,-32768,
1592 -32768,-32768,-32768,-32768,-32768,-32768, 1370, 1370, 1370, 1370,
1593 1370, 1370, 1370, 1370, 1370,-32768, 116,-32768, 34,-32768,
1594 -32768, 131, 1107,-32768, 6, -46,-32768, 164, 13,-32768,
1595 -32768, 13, 1067,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1596 -32768,-32768,-32768,-32768, 317, 405, 173, 178, 179, 189,
1597 192, 1179, 1481, 987, 314, 193, 197, 198,-32768,-32768,
1598 202, 203,-32768, 93, 565,-32768, 699, 699,-32768, 699,
1599 1330,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1600 -32768, 1370,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1601 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1370, 113,
1602 137,-32768, 565, -10, 205, 207, 208, 210, 218, 219,
1603 565, 565, 330, 1330, 1370, 1370,-32768,-32768,-32768,-32768,
1604 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 106,-32768,
1605 -32768,-32768, 106, 202, 202, 331, 220, 221, 1299, 1299,
1606 1299, 1299, 1299,-32768,-32768, -41, 1005, -61,-32768, -91,
1607 -32768, 1299, 1299, 1299, -13,-32768, 1219,-32768,-32768,-32768,
1608 -32768,-32768,-32768,-32768,-32768, 313, 1299,-32768,-32768,-32768,
1609 -32768, 226,-32768, 227, 699, 565, 565, 23,-32768, 24,
1610 -32768,-32768, 699, 223, 1370, 1370, 1370, 1370, 1370, 232,
1611 233, 1370, 699, 565, 234,-32768,-32768,-32768,-32768,-32768,
1612 -32768,-32768, 1370, 1299, 1299,-32768, 235, 236, 237, 239,
1613 1299,-32768, 231, 724, -76,-32768,-32768, 241, 242, 352,
1614 369, 388,-32768, 202,-32768, 13, 246, 243,-32768, 374,
1615 -59, 380, 385, 253, 257, 270, 699, 414, 699, 272,
1616 273, 699, 278, 13,-32768, 280, 282, 699, 699, 13,
1617 283, 287, 1370, -112, 288, 289, -33, 1299, 1299, 1299,
1618 1299,-32768,-32768, 294, 1299, 1299, 1370,-32768,-32768,-32768,
1619 79, 1259,-32768, 292,-32768, 699, 699, 1370, 699, 699,
1620 287,-32768, 287, 1370, 699, 307, 1370, 1370, 1370,-32768,
1621 -32768, 1370, 392,-32768, 565,-32768, 1299, 1299,-32768, 308,
1622 295, 309, 310,-32768, 301, 315, 7,-32768,-32768,-32768,
1623 13, 10, 427, 318, 306, 565, 52,-32768,-32768,-32768,
1624 -32768,-32768, 316, 699,-32768,-32768,-32768, 71, 287, 322,
1625 325, 1299,-32768, 1299, 1299,-32768,-32768,-32768, 79,-32768,
1626 407,-32768, 444, -4,-32768, 1370,-32768,-32768, 323,-32768,
1627 -32768,-32768,-32768, 327, 328, 329,-32768, 464,-32768, 699,
1628 -32768, 859, -3, 131, 565, -14,-32768, 106,-32768,-32768,
1629 -32768,-32768,-32768, 334,-32768, 859,-32768, 452, 465, 336,
1630 131, 699, 699, 468, 416,-32768, 699, 471,-32768, 699,
1631 -32768, 490, 491,-32768
1634 static const short yypgoto[] = { 365,
1635 366, 367, 255, 251, -168,-32768, 0, -40, 408, 14,
1636 -32768,-32768,-32768,-32768, 40,-32768,-32768,-32768, -158,-32768,
1637 -406,-32768, -226,-32768, -290, 3,-32768, -317,-32768,-32768,
1638 -25, 296, -119,-32768, 409, 413, -60, -155, -231, 166,
1639 119, 284,-32768,-32768, 504,-32768,-32768,-32768,-32768,-32768,
1640 -32768,-32768,-32768,-32768,-32768,-32768, 435,-32768,-32768,-32768,
1641 -32768,-32768,-32768, -525, -139, 47, -183,-32768, 474,-32768,
1642 -32768,-32768,-32768,-32768, 37, 124,-32768,-32768,-32768,-32768
1649 static const short yytable[] = { 11,
1650 79, 270, 259, 333, 161, 102, 269, 269, 234, 302,
1651 381, 162, 271, 13, 23, 11, 401, 402, 260, 471,
1652 421, 348, 350, 578, 306, 307, 308, 309, 310, 13,
1653 20, 313, 88, 437, 439, 108, 574, 109, 496, 422,
1654 91, -200, 140, 421, 21, -54, -54, -54, -54, 106,
1655 580, 140, 25, 141, 2, 411, 159, 4, 314, -66,
1656 1, 2, 228, 3, 4, 5, 417, 129, 235, 236,
1657 411, 6, 7, 132, 130, 438, 438, 106, 81, 82,
1658 267, 464, 231, 132, 86, 411, 268, 411, 147, 11,
1659 87, 43, 8, 44, 416, 9, 475, 1, 147, 10,
1660 3, 108, 5, 109, 539, 411, 470, 115, 116, 331,
1661 225, 226, 412, 484, 229, 415, 24, 499, 232, 396,
1662 397, 398, 26, 27, 399, 370, 1, 370, 370, 3,
1663 370, 5, 395, 55, 83, 431, 84, 108, 564, 109,
1664 163, 383, 265, 396, 397, 398, 315, 316, 399, 561,
1665 575, 375, 57, 108, 108, 109, 109, 538, 103, 330,
1666 108, 494, 109, 370, 56, 300, 301, 265, 303, 92,
1667 581, 370, 370, 59, 262, 118, 119, 120, 121, 122,
1668 123, 304, 265, 265, 265, 265, 265, 311, 312, 265,
1669 520, 112, 521, 113, 393, 317, 318, 132, 546, 110,
1670 111, 443, 547, 445, 446, 447, 88, 147, 95, 47,
1671 48, 49, 319, 320, 50, 321, 322, 546, 323, 324,
1672 325, 550, 96, 28, 29, 30, 31, 32, 33, 34,
1673 97, 35, 36, 37, 38, 370, 370, 370, 551, 396,
1674 397, 398, 99, 370, 399, 147, 512, 317, 318, 237,
1675 238, 239, 240, 370, 370, 100, 376, 101, 259, 378,
1676 108, 84, 109, 136, 319, 320, 137, 321, 322, 160,
1677 323, 324, 325, 377, 260, 143, 144, 221, 406, 407,
1678 408, 409, 410, 380, 108, 223, 109, 227, 147, 394,
1679 265, 418, 419, 420, 224, 230, 233, 370, -55, 370,
1680 522, -56, 370, 525, 526, 527, -59, -58, 370, 370,
1681 -57, 241, 263, 372, 373, 269, 374, 61, 62, 332,
1682 566, 414, 339, 568, 36, 37, 38, 340, 341, 1,
1683 2, 426, 3, 4, 5, 351, 370, 370, 342, 370,
1684 370, 343, 352, 455, 456, 370, 353, 354, 355, 382,
1685 462, 384, 357, 385, 386, 370, 387, 390, 391, 265,
1686 444, 265, 265, 265, 388, 389, 450, 392, 403, 404,
1687 405, 429, 432, 433, 442, 562, 370, 454, 448, 449,
1688 453, 458, 459, 460, 370, 461, 463, 465, 466, 467,
1689 468, 469, 472, 473, 576, 474, 476, 500, 501, 502,
1690 503, 477, 478, 479, 505, 506, 272, 273, 274, 275,
1691 276, 277, 278, 279, 280, 281, 480, 482, 484, 485,
1692 370, 434, 435, 436, 487, 370, 488, 495, 489, 441,
1693 283, 284, 492, 493, 497, 498, 530, 531, 513, 451,
1694 452, 507, 370, 370, 438, 533, 511, 370, 542, 504,
1695 370, 536, 516, 524, 532, 534, 535, 544, 265, 558,
1696 560, 265, 265, 265, 543, 537, 516, 572, 582, 548,
1697 508, 554, 552, 555, 556, 553, 567, 569, 570, 571,
1698 579, 583, 584, 481, 587, 483, 588, 590, 486, 593,
1699 594, 213, 214, 215, 490, 491, 338, 127, 557, 337,
1700 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1701 295, 296, 297, 298, 540, 139, 336, 142, 328, 42,
1702 565, 126, 514, 515, -199, 518, 519, 94, 528, 457,
1703 0, 523, 0, 0, 0, 0, 0, 0, 508, 0,
1704 0, 529, -66, 1, 2, 0, 3, 4, 5, 0,
1705 0, 0, 0, 0, 6, 7, 0, 0, 0, 0,
1706 0, 0, 545, 0, 0, 0, 0, 358, 359, 0,
1707 549, 61, 62, 360, 0, 8, 0, 0, 9, 0,
1708 0, 0, 10, 1, 2, 0, 3, 4, 5, 361,
1709 362, 363, 0, 0, 0, 0, 0, 0, 0, 0,
1710 0, 0, 0, 0, 364, 365, 573, 0, 0, 0,
1711 0, 577, 0, 0, 0, 0, 0, 0, 0, 0,
1712 0, 366, 0, 0, 0, 0, 0, 0, 585, 586,
1713 0, 0, 0, 589, 0, 0, 591, 174, 175, 176,
1714 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1715 187, 188, 245, 246, 0, 0, 0, 0, 0, 0,
1716 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1717 0, 0, 0, 0, 0, 0, 0, 0, 0, 247,
1718 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1719 205, 206, 0, 248, 0, 249, 250, 251, 0, 0,
1720 0, 358, 359, 0, 0, 61, 62, 360, 0, 0,
1721 0, 0, 108, 0, 109, 0, 0, 1, 2, 367,
1722 3, 4, 5, 361, 362, 363, 0, 0, 0, 0,
1723 61, 62, 0, 0, 0, 0, 0, 0, 364, 365,
1724 0, 0, 1, 2, 0, 3, 4, 5, 242, 0,
1725 0, 0, 0, 0, 0, 366, 0, 0, 0, 0,
1726 0, 0, 0, 243, 244, 0, 0, 0, 0, 0,
1727 0, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1728 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1729 0, 0, 0, 0, 0, 0, 174, 175, 176, 177,
1730 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1731 188, 245, 246, 247, 195, 196, 197, 198, 199, 200,
1732 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1733 250, 251, 0, 0, 0, 0, 0, 0, 247, 195,
1734 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
1735 206, 0, 248, 367, 249, 250, 251, 0, 0, 0,
1736 0, 358, 359, 0, 0, 0, 0, 360, 0, 0,
1737 0, 108, 0, 109, 0, 252, 0, 0, 253, 0,
1738 254, 0, 255, 361, 362, 363, 0, 0, 0, 0,
1739 0, 0, 0, 0, 0, 0, 0, 0, 364, 365,
1740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1741 0, 0, 0, 61, 62, 366, 104, 64, 65, 66,
1742 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1743 5, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1744 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1745 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1746 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1747 5, 0, 0, 247, 195, 196, 197, 198, 199, 200,
1748 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1749 250, 251, 0, 61, 62, 71, 104, 150, 151, 152,
1750 153, 154, 155, 70, 0, 1, 2, 0, 3, 4,
1751 5, 61, 62, 367, 104, 150, 151, 152, 153, 154,
1752 155, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1753 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1754 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1755 5, 0, 0, 71, 0, 72, 0, 0, 73, 0,
1756 0, 74, 0, 75, 105, 131, 0, 0, 0, 0,
1757 0, 0, 0, 61, 62, 71, 145, 64, 65, 66,
1758 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1759 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1760 0, 74, 0, 75, 138, 0, 0, 0, 0, 0,
1761 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1762 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1763 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1764 0, 74, 0, 75, 349, 327, 0, 0, 0, 0,
1765 0, 0, 0, 72, 0, 71, 73, 0, 0, 74,
1766 0, 75, 413, 0, 0, 0, 0, 0, 0, 0,
1767 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1768 0, 74, 0, 75, 0, 61, 62, 146, 104, 150,
1769 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1770 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1771 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1772 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1773 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1774 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1775 0, 0, 0, 0, 0, 72, 0, 425, 73, 0,
1776 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1777 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1778 3, 4, 5, 61, 62, 0, 63, 64, 65, 66,
1779 67, 68, 69, 70, 0, 1, 2, 510, 3, 4,
1780 5, 0, 0, 0, 0, 61, 62, 71, 104, 150,
1781 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1782 3, 4, 5, 0, 0, 71, 0, 72, 0, 0,
1783 73, 0, 344, 74, 0, 75, 61, 62, 0, 145,
1784 64, 65, 66, 67, 68, 69, 70, 71, 1, 2,
1785 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1786 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1787 73, 0, 0, 74, 0, 75, 61, 62, 71, 104,
1788 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1789 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1790 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1791 73, 0, 0, 74, 0, 75, 0, 0, 71, 0,
1792 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1793 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
1794 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1795 73, 0, 0, 74, 0, 75, 61, 62, 0, 264,
1796 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1797 0, 3, 4, 5, 0, 0, 0, 0, 72, 0,
1798 0, 73, 0, 0, 74, 0, 75, 61, 62, 0,
1799 104, 150, 151, 152, 153, 154, 155, 70, 71, 1,
1800 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
1801 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1802 0, 73, 0, 0, 74, 0, 75, 0, 0, 71,
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, 0, 0,
1809 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1810 0, 73, 0, 0, 74, 0, 75, 165, 0, 0,
1811 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1812 0, 0, 0, 0, 0, 0, 166, 167, 0, 72,
1813 0, 0, 73, 0, 0, 74, 0, 347, 168, 169,
1814 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
1815 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1816 190, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1817 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1818 0, 191, 192, 193, 0, 0, 194, 195, 196, 197,
1819 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1820 208, 209, 210, 211, 212
1823 static const short yycheck[] = { 0,
1824 26, 170, 158, 230, 124, 4, 11, 11, 148, 193,
1825 301, 28, 171, 0, 146, 16, 334, 335, 158, 426,
1826 34, 253, 254, 38, 208, 209, 210, 211, 212, 16,
1827 52, 215, 21, 11, 11, 148, 562, 150, 151, 53,
1828 29, 0, 147, 34, 66, 3, 4, 5, 6, 75,
1829 576, 147, 146, 158, 20, 147, 117, 23, 217, 18,
1830 19, 20, 158, 22, 23, 24, 158, 147, 26, 27,
1831 147, 30, 31, 99, 154, 53, 53, 103, 39, 40,
1832 11, 158, 143, 109, 45, 147, 17, 147, 114, 90,
1833 51, 46, 51, 48, 156, 54, 156, 19, 124, 58,
1834 22, 148, 24, 150, 511, 147, 424, 32, 33, 156,
1835 136, 137, 154, 147, 140, 347, 57, 151, 144, 134,
1836 135, 136, 18, 146, 139, 265, 19, 267, 268, 22,
1837 270, 24, 316, 146, 35, 367, 37, 148, 545, 150,
1838 157, 152, 168, 134, 135, 136, 113, 114, 139, 154,
1839 154, 271, 152, 148, 148, 150, 150, 151, 157, 154,
1840 148, 452, 150, 303, 146, 191, 192, 193, 194, 158,
1841 577, 311, 312, 22, 161, 60, 61, 62, 63, 64,
1842 65, 207, 208, 209, 210, 211, 212, 213, 214, 215,
1843 481, 42, 483, 44, 314, 117, 118, 223, 147, 81,
1844 82, 385, 151, 387, 388, 389, 21, 233, 22, 42,
1845 43, 44, 134, 135, 47, 137, 138, 147, 140, 141,
1846 142, 151, 22, 42, 43, 44, 45, 46, 47, 48,
1847 22, 50, 143, 144, 145, 375, 376, 377, 529, 134,
1848 135, 136, 150, 383, 139, 271, 473, 117, 118, 3,
1849 4, 5, 6, 393, 394, 4, 282, 4, 414, 147,
1850 148, 37, 150, 153, 134, 135, 153, 137, 138, 4,
1851 140, 141, 142, 299, 414, 110, 111, 22, 339, 340,
1852 341, 342, 343, 147, 148, 147, 150, 156, 314, 315,
1853 316, 352, 353, 354, 151, 151, 150, 437, 9, 439,
1854 484, 9, 442, 487, 488, 489, 9, 9, 448, 449,
1855 9, 9, 55, 267, 268, 11, 270, 7, 8, 156,
1856 547, 347, 150, 550, 143, 144, 145, 150, 150, 19,
1857 20, 357, 22, 23, 24, 22, 476, 477, 150, 479,
1858 480, 150, 150, 404, 405, 485, 150, 150, 147, 303,
1859 411, 147, 150, 147, 147, 495, 147, 311, 312, 385,
1860 386, 387, 388, 389, 147, 147, 392, 38, 38, 150,
1861 150, 59, 147, 147, 152, 544, 516, 403, 147, 147,
1862 147, 147, 147, 147, 524, 147, 156, 147, 147, 38,
1863 22, 4, 147, 151, 563, 22, 17, 458, 459, 460,
1864 461, 17, 150, 147, 465, 466, 90, 91, 92, 93,
1865 94, 95, 96, 97, 98, 99, 147, 4, 147, 147,
1866 560, 375, 376, 377, 147, 565, 147, 453, 147, 383,
1867 26, 27, 150, 147, 147, 147, 497, 498, 147, 393,
1868 394, 467, 582, 583, 53, 151, 472, 587, 22, 156,
1869 590, 151, 478, 147, 147, 147, 147, 152, 484, 53,
1870 17, 487, 488, 489, 147, 151, 492, 4, 17, 154,
1871 471, 532, 151, 534, 535, 151, 154, 151, 151, 151,
1872 147, 17, 147, 437, 17, 439, 71, 17, 442, 0,
1873 0, 127, 127, 127, 448, 449, 246, 90, 539, 245,
1874 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1875 106, 107, 108, 109, 512, 103, 233, 109, 223, 16,
1876 546, 87, 476, 477, 0, 479, 480, 54, 492, 406,
1877 -1, 485, -1, -1, -1, -1, -1, -1, 539, -1,
1878 -1, 495, 18, 19, 20, -1, 22, 23, 24, -1,
1879 -1, -1, -1, -1, 30, 31, -1, -1, -1, -1,
1880 -1, -1, 516, -1, -1, -1, -1, 3, 4, -1,
1881 524, 7, 8, 9, -1, 51, -1, -1, 54, -1,
1882 -1, -1, 58, 19, 20, -1, 22, 23, 24, 25,
1883 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
1884 -1, -1, -1, -1, 40, 41, 560, -1, -1, -1,
1885 -1, 565, -1, -1, -1, -1, -1, -1, -1, -1,
1886 -1, 57, -1, -1, -1, -1, -1, -1, 582, 583,
1887 -1, -1, -1, 587, -1, -1, 590, 73, 74, 75,
1888 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1889 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
1890 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1891 -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
1892 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1893 126, 127, -1, 129, -1, 131, 132, 133, -1, -1,
1894 -1, 3, 4, -1, -1, 7, 8, 9, -1, -1,
1895 -1, -1, 148, -1, 150, -1, -1, 19, 20, 155,
1896 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
1897 7, 8, -1, -1, -1, -1, -1, -1, 40, 41,
1898 -1, -1, 19, 20, -1, 22, 23, 24, 25, -1,
1899 -1, -1, -1, -1, -1, 57, -1, -1, -1, -1,
1900 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
1901 -1, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1902 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1903 -1, -1, -1, -1, -1, -1, 73, 74, 75, 76,
1904 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1905 87, 88, 89, 115, 116, 117, 118, 119, 120, 121,
1906 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1907 132, 133, -1, -1, -1, -1, -1, -1, 115, 116,
1908 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1909 127, -1, 129, 155, 131, 132, 133, -1, -1, -1,
1910 -1, 3, 4, -1, -1, -1, -1, 9, -1, -1,
1911 -1, 148, -1, 150, -1, 152, -1, -1, 155, -1,
1912 157, -1, 159, 25, 26, 27, -1, -1, -1, -1,
1913 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
1914 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1915 -1, -1, -1, 7, 8, 57, 10, 11, 12, 13,
1916 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1917 24, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1918 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1919 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1920 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1921 24, -1, -1, 115, 116, 117, 118, 119, 120, 121,
1922 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1923 132, 133, -1, 7, 8, 49, 10, 11, 12, 13,
1924 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1925 24, 7, 8, 155, 10, 11, 12, 13, 14, 15,
1926 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1927 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1928 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1929 24, -1, -1, 49, -1, 149, -1, -1, 152, -1,
1930 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1931 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1932 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1933 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1934 -1, 155, -1, 157, 158, -1, -1, -1, -1, -1,
1935 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1936 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1937 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1938 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1939 -1, -1, -1, 149, -1, 49, 152, -1, -1, 155,
1940 -1, 157, 158, -1, -1, -1, -1, -1, -1, -1,
1941 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1942 -1, 155, -1, 157, -1, 7, 8, 121, 10, 11,
1943 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1944 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1945 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1946 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1947 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1948 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1949 -1, -1, -1, -1, -1, 149, -1, 39, 152, -1,
1950 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1951 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1952 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
1953 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
1954 24, -1, -1, -1, -1, 7, 8, 49, 10, 11,
1955 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1956 22, 23, 24, -1, -1, 49, -1, 149, -1, -1,
1957 152, -1, 154, 155, -1, 157, 7, 8, -1, 10,
1958 11, 12, 13, 14, 15, 16, 17, 49, 19, 20,
1959 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1960 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1961 152, -1, -1, 155, -1, 157, 7, 8, 49, 10,
1962 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1963 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1964 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1965 152, -1, -1, 155, -1, 157, -1, -1, 49, -1,
1966 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1967 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
1968 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1969 152, -1, -1, 155, -1, 157, 7, 8, -1, 10,
1970 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1971 -1, 22, 23, 24, -1, -1, -1, -1, 149, -1,
1972 -1, 152, -1, -1, 155, -1, 157, 7, 8, -1,
1973 10, 11, 12, 13, 14, 15, 16, 17, 49, 19,
1974 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
1975 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1976 -1, 152, -1, -1, 155, -1, 157, -1, -1, 49,
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, -1, -1,
1983 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1984 -1, 152, -1, -1, 155, -1, 157, 36, -1, -1,
1985 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1986 -1, -1, -1, -1, -1, -1, 55, 56, -1, 149,
1987 -1, -1, 152, -1, -1, 155, -1, 157, 67, 68,
1988 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
1989 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1990 89, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1991 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1992 -1, 110, 111, 112, -1, -1, 115, 116, 117, 118,
1993 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
1994 129, 130, 131, 132, 133
1996 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1997 #line 3 "/usr/share/bison.simple"
1998 /* This file comes from bison-1.28. */
2000 /* Skeleton output parser for bison,
2001 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2003 This program is free software; you can redistribute it and/or modify
2004 it under the terms of the GNU General Public License as published by
2005 the Free Software Foundation; either version 2, or (at your option)
2008 This program is distributed in the hope that it will be useful,
2009 but WITHOUT ANY WARRANTY; without even the implied warranty of
2010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2011 GNU General Public License for more details.
2013 You should have received a copy of the GNU General Public License
2014 along with this program; if not, write to the Free Software
2015 Foundation, Inc., 59 Temple Place - Suite 330,
2016 Boston, MA 02111-1307, USA. */
2018 /* As a special exception, when this file is copied by Bison into a
2019 Bison output file, you may use that output file without restriction.
2020 This special exception was added by the Free Software Foundation
2021 in version 1.24 of Bison. */
2023 /* This is the parser code that is written into each bison parser
2024 when the %semantic_parser declaration is not specified in the grammar.
2025 It was written by Richard Stallman by simplifying the hairy parser
2026 used when %semantic_parser is specified. */
2028 #ifndef YYSTACK_USE_ALLOCA
2030 #define YYSTACK_USE_ALLOCA
2031 #else /* alloca not defined */
2033 #define YYSTACK_USE_ALLOCA
2034 #define alloca __builtin_alloca
2035 #else /* not GNU C. */
2036 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2037 #define YYSTACK_USE_ALLOCA
2039 #else /* not sparc */
2040 /* We think this test detects Watcom and Microsoft C. */
2041 /* This used to test MSDOS, but that is a bad idea
2042 since that symbol is in the user namespace. */
2043 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2044 #if 0 /* No need for malloc.h, which pollutes the namespace;
2045 instead, just don't use alloca. */
2048 #else /* not MSDOS, or __TURBOC__ */
2050 /* I don't know what this was needed for, but it pollutes the namespace.
2051 So I turned it off. rms, 2 May 1997. */
2052 /* #include <malloc.h> */
2054 #define YYSTACK_USE_ALLOCA
2055 #else /* not MSDOS, or __TURBOC__, or _AIX */
2057 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2058 and on HPUX 10. Eventually we can turn this on. */
2059 #define YYSTACK_USE_ALLOCA
2060 #define alloca __builtin_alloca
2063 #endif /* not _AIX */
2064 #endif /* not MSDOS, or __TURBOC__ */
2065 #endif /* not sparc */
2066 #endif /* not GNU C */
2067 #endif /* alloca not defined */
2068 #endif /* YYSTACK_USE_ALLOCA not defined */
2070 #ifdef YYSTACK_USE_ALLOCA
2071 #define YYSTACK_ALLOC alloca
2073 #define YYSTACK_ALLOC malloc
2076 /* Note: there must be only one dollar sign in this file.
2077 It is replaced by the list of actions, each action
2078 as one case of the switch. */
2080 #define yyerrok (yyerrstatus = 0)
2081 #define yyclearin (yychar = YYEMPTY)
2084 #define YYACCEPT goto yyacceptlab
2085 #define YYABORT goto yyabortlab
2086 #define YYERROR goto yyerrlab1
2087 /* Like YYERROR except do call yyerror.
2088 This remains here temporarily to ease the
2089 transition to the new meaning of YYERROR, for GCC.
2090 Once GCC version 2 has supplanted version 1, this can go. */
2091 #define YYFAIL goto yyerrlab
2092 #define YYRECOVERING() (!!yyerrstatus)
2093 #define YYBACKUP(token, value) \
2095 if (yychar == YYEMPTY && yylen == 1) \
2096 { yychar = (token), yylval = (value); \
2097 yychar1 = YYTRANSLATE (yychar); \
2102 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2106 #define YYERRCODE 256
2109 #define YYLEX yylex()
2115 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2117 #define YYLEX yylex(&yylval, &yylloc)
2119 #else /* not YYLSP_NEEDED */
2121 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2123 #define YYLEX yylex(&yylval)
2125 #endif /* not YYLSP_NEEDED */
2128 /* If nonreentrant, generate the variables here */
2132 int yychar; /* the lookahead symbol */
2133 YYSTYPE yylval; /* the semantic value of the */
2134 /* lookahead symbol */
2137 YYLTYPE yylloc; /* location data for the lookahead */
2141 int yynerrs; /* number of parse errors so far */
2142 #endif /* not YYPURE */
2145 int yydebug; /* nonzero means print parse trace */
2146 /* Since this is uninitialized, it does not stop multiple parsers
2150 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2153 #define YYINITDEPTH 200
2156 /* YYMAXDEPTH is the maximum size the stacks can grow to
2157 (effective only if the built-in stack extension method is used). */
2164 #define YYMAXDEPTH 10000
2167 /* Define __yy_memcpy. Note that the size argument
2168 should be passed with type unsigned int, because that is what the non-GCC
2169 definitions require. With GCC, __builtin_memcpy takes an arg
2170 of type size_t, but it can handle unsigned int. */
2172 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2173 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2174 #else /* not GNU C or C++ */
2177 /* This is the most reliable way to avoid incompatibilities
2178 in available built-in functions on various systems. */
2180 __yy_memcpy (to, from, count)
2185 register char *f = from;
2186 register char *t = to;
2187 register int i = count;
2193 #else /* __cplusplus */
2195 /* This is the most reliable way to avoid incompatibilities
2196 in available built-in functions on various systems. */
2198 __yy_memcpy (char *to, char *from, unsigned int count)
2200 register char *t = to;
2201 register char *f = from;
2202 register int i = count;
2211 #line 217 "/usr/share/bison.simple"
2213 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2214 into yyparse. The argument should have type void *.
2215 It should actually point to an object.
2216 Grammar actions can access the variable by casting it
2217 to the proper pointer type. */
2219 #ifdef YYPARSE_PARAM
2221 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2222 #define YYPARSE_PARAM_DECL
2223 #else /* not __cplusplus */
2224 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2225 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2226 #endif /* not __cplusplus */
2227 #else /* not YYPARSE_PARAM */
2228 #define YYPARSE_PARAM_ARG
2229 #define YYPARSE_PARAM_DECL
2230 #endif /* not YYPARSE_PARAM */
2232 /* Prevent warning if -Wstrict-prototypes. */
2234 #ifdef YYPARSE_PARAM
2235 int yyparse (void *);
2242 yyparse(YYPARSE_PARAM_ARG)
2245 register int yystate;
2247 register short *yyssp;
2248 register YYSTYPE *yyvsp;
2249 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2250 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2252 short yyssa[YYINITDEPTH]; /* the state stack */
2253 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2255 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2256 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2259 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2260 YYLTYPE *yyls = yylsa;
2263 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2265 #define YYPOPSTACK (yyvsp--, yyssp--)
2268 int yystacksize = YYINITDEPTH;
2269 int yyfree_stacks = 0;
2280 YYSTYPE yyval; /* the variable used to return */
2281 /* semantic values from the action */
2288 fprintf(stderr, "Starting parse\n");
2294 yychar = YYEMPTY; /* Cause a token to be read. */
2296 /* Initialize stack pointers.
2297 Waste one element of value and location stack
2298 so that they stay on the same level as the state stack.
2299 The wasted elements are never initialized. */
2307 /* Push a new state, which is found in yystate . */
2308 /* In all cases, when you get here, the value and location stacks
2309 have just been pushed. so pushing a state here evens the stacks. */
2314 if (yyssp >= yyss + yystacksize - 1)
2316 /* Give user a chance to reallocate the stack */
2317 /* Use copies of these so that the &'s don't force the real ones into memory. */
2318 YYSTYPE *yyvs1 = yyvs;
2319 short *yyss1 = yyss;
2321 YYLTYPE *yyls1 = yyls;
2324 /* Get the current used size of the three stacks, in elements. */
2325 int size = yyssp - yyss + 1;
2328 /* Each stack pointer address is followed by the size of
2329 the data in use in that stack, in bytes. */
2331 /* This used to be a conditional around just the two extra args,
2332 but that might be undefined if yyoverflow is a macro. */
2333 yyoverflow("parser stack overflow",
2334 &yyss1, size * sizeof (*yyssp),
2335 &yyvs1, size * sizeof (*yyvsp),
2336 &yyls1, size * sizeof (*yylsp),
2339 yyoverflow("parser stack overflow",
2340 &yyss1, size * sizeof (*yyssp),
2341 &yyvs1, size * sizeof (*yyvsp),
2345 yyss = yyss1; yyvs = yyvs1;
2349 #else /* no yyoverflow */
2350 /* Extend the stack our own way. */
2351 if (yystacksize >= YYMAXDEPTH)
2353 yyerror("parser stack overflow");
2365 if (yystacksize > YYMAXDEPTH)
2366 yystacksize = YYMAXDEPTH;
2367 #ifndef YYSTACK_USE_ALLOCA
2370 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2371 __yy_memcpy ((char *)yyss, (char *)yyss1,
2372 size * (unsigned int) sizeof (*yyssp));
2373 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2374 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2375 size * (unsigned int) sizeof (*yyvsp));
2377 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2378 __yy_memcpy ((char *)yyls, (char *)yyls1,
2379 size * (unsigned int) sizeof (*yylsp));
2381 #endif /* no yyoverflow */
2383 yyssp = yyss + size - 1;
2384 yyvsp = yyvs + size - 1;
2386 yylsp = yyls + size - 1;
2391 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2394 if (yyssp >= yyss + yystacksize - 1)
2400 fprintf(stderr, "Entering state %d\n", yystate);
2406 /* Do appropriate processing given the current state. */
2407 /* Read a lookahead token if we need one and don't already have one. */
2410 /* First try to decide what to do without reference to lookahead token. */
2412 yyn = yypact[yystate];
2416 /* Not known => get a lookahead token if don't already have one. */
2418 /* yychar is either YYEMPTY or YYEOF
2419 or a valid token in external form. */
2421 if (yychar == YYEMPTY)
2425 fprintf(stderr, "Reading a token: ");
2430 /* Convert token to internal form (in yychar1) for indexing tables with */
2432 if (yychar <= 0) /* This means end of input. */
2435 yychar = YYEOF; /* Don't call YYLEX any more */
2439 fprintf(stderr, "Now at end of input.\n");
2444 yychar1 = YYTRANSLATE(yychar);
2449 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2450 /* Give the individual parser a way to print the precise meaning
2451 of a token, for further debugging info. */
2453 YYPRINT (stderr, yychar, yylval);
2455 fprintf (stderr, ")\n");
2461 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2466 /* yyn is what to do for this token type in this state.
2467 Negative => reduce, -yyn is rule number.
2468 Positive => shift, yyn is new state.
2469 New state is final state => don't bother to shift,
2470 just return success.
2471 0, or most negative number => error. */
2486 /* Shift the lookahead token. */
2490 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2493 /* Discard the token being shifted unless it is eof. */
2494 if (yychar != YYEOF)
2502 /* count tokens shifted since error; after three, turn off error status. */
2503 if (yyerrstatus) yyerrstatus--;
2508 /* Do the default action for the current state. */
2511 yyn = yydefact[yystate];
2515 /* Do a reduction. yyn is the number of a rule to reduce with. */
2519 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2526 fprintf (stderr, "Reducing via rule %d (line %d), ",
2529 /* Print the symbols being reduced, and their result. */
2530 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2531 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2532 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2540 #line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2541 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2544 #line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2545 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2548 #line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2549 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2552 #line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2553 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2556 #line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2557 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2560 #line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2561 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2564 #line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2565 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2568 #line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2569 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2572 #line 1137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2573 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2576 #line 1137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2577 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2580 #line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2581 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2584 #line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2585 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2588 #line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2589 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2592 #line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2593 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2596 #line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2597 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2600 #line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2601 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2604 #line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2605 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2608 #line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2609 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2612 #line 1145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2613 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2616 #line 1145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2617 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2620 #line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2621 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2624 #line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2625 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2628 #line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2629 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2632 #line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2633 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2636 #line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2637 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2640 #line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2641 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2644 #line 1158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2645 { yyval.StrVal = 0; ;
2648 #line 1162 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2650 yyval.StrVal = yyvsp[-1].StrVal;
2655 #line 1166 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2662 #line 1174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2669 #line 1179 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2671 yyval.StrVal = yyvsp[-1].StrVal;
2676 #line 1185 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2677 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2680 #line 1186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2681 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2684 #line 1187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2685 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2688 #line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2689 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2692 #line 1189 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2693 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2696 #line 1193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2697 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2700 #line 1194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2701 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2704 #line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2705 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2708 #line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2709 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2712 #line 1200 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2713 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2716 #line 1201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2717 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2720 #line 1202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2721 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2724 #line 1206 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2725 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2728 #line 1207 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2729 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2732 #line 1208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2733 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2736 #line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2737 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2740 #line 1213 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2741 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2744 #line 1214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2745 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2748 #line 1215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2749 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2752 #line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2753 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2756 #line 1220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2757 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2760 #line 1221 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2761 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2764 #line 1222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2765 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2768 #line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2769 { yyval.UIntVal = CallingConv::C; ;
2772 #line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2773 { yyval.UIntVal = CallingConv::C; ;
2776 #line 1227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2777 { yyval.UIntVal = CallingConv::Fast; ;
2780 #line 1228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2781 { yyval.UIntVal = CallingConv::Cold; ;
2784 #line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2785 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2788 #line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2789 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2792 #line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2794 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2795 GEN_ERROR("Calling conv too large");
2796 yyval.UIntVal = yyvsp[0].UInt64Val;
2801 #line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2802 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2805 #line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2806 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2809 #line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2810 { yyval.ParamAttrs = ParamAttr::SExt; ;
2813 #line 1241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2814 { yyval.ParamAttrs = ParamAttr::SExt; ;
2817 #line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2818 { yyval.ParamAttrs = ParamAttr::InReg; ;
2821 #line 1243 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2822 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2825 #line 1244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2826 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2829 #line 1245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2830 { yyval.ParamAttrs = ParamAttr::ByVal; ;
2833 #line 1246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2834 { yyval.ParamAttrs = ParamAttr::Nest; ;
2837 #line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2838 { yyval.ParamAttrs = ParamAttr::None; ;
2841 #line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2843 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2847 #line 1255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2848 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2851 #line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2852 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2855 #line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2856 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2859 #line 1258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2860 { yyval.ParamAttrs = ParamAttr::SExt; ;
2863 #line 1261 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2864 { yyval.ParamAttrs = ParamAttr::None; ;
2867 #line 1262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2869 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2873 #line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2874 { yyval.UIntVal = 0; ;
2877 #line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2879 yyval.UIntVal = yyvsp[0].UInt64Val;
2880 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2881 GEN_ERROR("Alignment must be a power of two");
2886 #line 1276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2887 { yyval.UIntVal = 0; ;
2890 #line 1277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2892 yyval.UIntVal = yyvsp[0].UInt64Val;
2893 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2894 GEN_ERROR("Alignment must be a power of two");
2899 #line 1285 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2901 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2902 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2903 GEN_ERROR("Invalid character in section name");
2904 yyval.StrVal = yyvsp[0].StrVal;
2909 #line 1293 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2910 { yyval.StrVal = 0; ;
2913 #line 1294 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2914 { yyval.StrVal = yyvsp[0].StrVal; ;
2917 #line 1299 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2921 #line 1300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2925 #line 1301 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2927 CurGV->setSection(*yyvsp[0].StrVal);
2928 delete yyvsp[0].StrVal;
2933 #line 1306 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2935 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2936 GEN_ERROR("Alignment must be a power of two");
2937 CurGV->setAlignment(yyvsp[0].UInt64Val);
2942 #line 1322 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2944 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2949 #line 1326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2951 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2956 #line 1330 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2958 if (*yyvsp[-1].TypeVal == Type::LabelTy)
2959 GEN_ERROR("Cannot form a pointer to a basic block");
2960 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2961 delete yyvsp[-1].TypeVal;
2966 #line 1337 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2967 { // Named types are also simple types...
2968 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
2970 yyval.TypeVal = new PATypeHolder(tmp);
2974 #line 1342 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2975 { // Type UpReference
2976 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
2977 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2978 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2979 yyval.TypeVal = new PATypeHolder(OT);
2980 UR_OUT("New Upreference!\n");
2985 #line 1350 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2987 std::vector<const Type*> Params;
2988 ParamAttrsVector Attrs;
2989 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
2990 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
2994 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
2995 for (; I != E; ++I, ++index) {
2996 const Type *Ty = I->Ty->get();
2997 Params.push_back(Ty);
2998 if (Ty != Type::VoidTy)
2999 if (I->Attrs != ParamAttr::None) {
3000 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3004 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3005 if (isVarArg) Params.pop_back();
3007 ParamAttrsList *ActualAttrs = 0;
3009 ActualAttrs = ParamAttrsList::get(Attrs);
3010 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3011 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3012 delete yyvsp[-4].TypeVal; // Delete the return type handle
3013 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3018 #line 1380 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3020 std::vector<const Type*> Params;
3021 ParamAttrsVector Attrs;
3022 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3023 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3026 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3028 for ( ; I != E; ++I, ++index) {
3029 const Type* Ty = I->Ty->get();
3030 Params.push_back(Ty);
3031 if (Ty != Type::VoidTy)
3032 if (I->Attrs != ParamAttr::None) {
3033 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3037 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3038 if (isVarArg) Params.pop_back();
3040 ParamAttrsList *ActualAttrs = 0;
3042 ActualAttrs = ParamAttrsList::get(Attrs);
3044 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3045 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3046 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3051 #line 1411 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3052 { // Sized array type?
3053 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3054 delete yyvsp[-1].TypeVal;
3059 #line 1416 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3061 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3062 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3063 GEN_ERROR("Unsigned result not equal to signed result");
3064 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3065 GEN_ERROR("Element type of a VectorType must be primitive");
3066 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3067 GEN_ERROR("Vector length should be a power of 2");
3068 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3069 delete yyvsp[-1].TypeVal;
3074 #line 1428 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3075 { // Structure type?
3076 std::vector<const Type*> Elements;
3077 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3078 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3079 Elements.push_back(*I);
3081 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3082 delete yyvsp[-1].TypeList;
3087 #line 1438 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3088 { // Empty structure type?
3089 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3094 #line 1442 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3096 std::vector<const Type*> Elements;
3097 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3098 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3099 Elements.push_back(*I);
3101 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3102 delete yyvsp[-2].TypeList;
3107 #line 1452 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3108 { // Empty structure type?
3109 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3114 #line 1459 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3116 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3117 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3121 #line 1466 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3123 if (!UpRefs.empty())
3124 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3125 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3126 GEN_ERROR("LLVM functions cannot return aggregate types");
3127 yyval.TypeVal = yyvsp[0].TypeVal;
3131 #line 1473 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3133 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3137 #line 1478 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3139 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3140 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3145 #line 1483 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3147 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3152 #line 1491 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3154 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3155 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3156 TWA.Ty = new PATypeHolder(Type::VoidTy);
3157 yyval.TypeWithAttrsList->push_back(TWA);
3162 #line 1498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3164 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3165 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3166 TWA.Ty = new PATypeHolder(Type::VoidTy);
3167 yyval.TypeWithAttrsList->push_back(TWA);
3172 #line 1505 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3174 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3179 #line 1513 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3181 yyval.TypeList = new std::list<PATypeHolder>();
3182 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3183 delete yyvsp[0].TypeVal;
3188 #line 1519 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3190 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3191 delete yyvsp[0].TypeVal;
3196 #line 1531 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3197 { // Nonempty unsized arr
3198 if (!UpRefs.empty())
3199 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3200 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3202 GEN_ERROR("Cannot make array constant with type: '" +
3203 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3204 const Type *ETy = ATy->getElementType();
3205 int NumElements = ATy->getNumElements();
3207 // Verify that we have the correct size...
3208 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3209 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3210 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3211 itostr(NumElements) + "");
3213 // Verify all elements are correct type!
3214 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3215 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3216 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3217 ETy->getDescription() +"' as required!\nIt is of type '"+
3218 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3221 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3222 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3227 #line 1559 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3229 if (!UpRefs.empty())
3230 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3231 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3233 GEN_ERROR("Cannot make array constant with type: '" +
3234 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3236 int NumElements = ATy->getNumElements();
3237 if (NumElements != -1 && NumElements != 0)
3238 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3239 " arguments, but has size of " + itostr(NumElements) +"");
3240 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3241 delete yyvsp[-2].TypeVal;
3246 #line 1575 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3248 if (!UpRefs.empty())
3249 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3250 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3252 GEN_ERROR("Cannot make array constant with type: '" +
3253 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3255 int NumElements = ATy->getNumElements();
3256 const Type *ETy = ATy->getElementType();
3257 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3258 GEN_ERROR("Can't build string constant of size " +
3259 itostr((int)(yyvsp[0].StrVal->length())) +
3260 " when array has size " + itostr(NumElements) + "");
3261 std::vector<Constant*> Vals;
3262 if (ETy == Type::Int8Ty) {
3263 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3264 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3266 delete yyvsp[0].StrVal;
3267 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3269 delete yyvsp[0].StrVal;
3270 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3271 delete yyvsp[-2].TypeVal;
3276 #line 1602 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3277 { // Nonempty unsized arr
3278 if (!UpRefs.empty())
3279 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3280 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3282 GEN_ERROR("Cannot make packed constant with type: '" +
3283 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3284 const Type *ETy = PTy->getElementType();
3285 int NumElements = PTy->getNumElements();
3287 // Verify that we have the correct size...
3288 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3289 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3290 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3291 itostr(NumElements) + "");
3293 // Verify all elements are correct type!
3294 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3295 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3296 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3297 ETy->getDescription() +"' as required!\nIt is of type '"+
3298 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3301 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3302 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3307 #line 1630 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3309 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3311 GEN_ERROR("Cannot make struct constant with type: '" +
3312 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3314 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3315 GEN_ERROR("Illegal number of initializers for structure type");
3317 // Check to ensure that constants are compatible with the type initializer!
3318 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3319 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3320 GEN_ERROR("Expected type '" +
3321 STy->getElementType(i)->getDescription() +
3322 "' for element #" + utostr(i) +
3323 " of structure initializer");
3325 // Check to ensure that Type is not packed
3326 if (STy->isPacked())
3327 GEN_ERROR("Unpacked Initializer to vector type '" +
3328 STy->getDescription() + "'");
3330 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3331 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3336 #line 1656 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3338 if (!UpRefs.empty())
3339 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3340 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3342 GEN_ERROR("Cannot make struct constant with type: '" +
3343 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3345 if (STy->getNumContainedTypes() != 0)
3346 GEN_ERROR("Illegal number of initializers for structure type");
3348 // Check to ensure that Type is not packed
3349 if (STy->isPacked())
3350 GEN_ERROR("Unpacked Initializer to vector type '" +
3351 STy->getDescription() + "'");
3353 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3354 delete yyvsp[-2].TypeVal;
3359 #line 1676 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3361 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3363 GEN_ERROR("Cannot make struct constant with type: '" +
3364 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3366 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3367 GEN_ERROR("Illegal number of initializers for structure type");
3369 // Check to ensure that constants are compatible with the type initializer!
3370 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3371 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3372 GEN_ERROR("Expected type '" +
3373 STy->getElementType(i)->getDescription() +
3374 "' for element #" + utostr(i) +
3375 " of structure initializer");
3377 // Check to ensure that Type is packed
3378 if (!STy->isPacked())
3379 GEN_ERROR("Vector initializer to non-vector type '" +
3380 STy->getDescription() + "'");
3382 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3383 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3388 #line 1702 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3390 if (!UpRefs.empty())
3391 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3392 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3394 GEN_ERROR("Cannot make struct constant with type: '" +
3395 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3397 if (STy->getNumContainedTypes() != 0)
3398 GEN_ERROR("Illegal number of initializers for structure type");
3400 // Check to ensure that Type is packed
3401 if (!STy->isPacked())
3402 GEN_ERROR("Vector initializer to non-vector type '" +
3403 STy->getDescription() + "'");
3405 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3406 delete yyvsp[-4].TypeVal;
3411 #line 1722 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3413 if (!UpRefs.empty())
3414 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3415 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3417 GEN_ERROR("Cannot make null pointer constant with type: '" +
3418 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3420 yyval.ConstVal = ConstantPointerNull::get(PTy);
3421 delete yyvsp[-1].TypeVal;
3426 #line 1734 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3428 if (!UpRefs.empty())
3429 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3430 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3431 delete yyvsp[-1].TypeVal;
3436 #line 1741 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3438 if (!UpRefs.empty())
3439 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3440 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3442 GEN_ERROR("Global const reference must be a pointer type");
3444 // ConstExprs can exist in the body of a function, thus creating
3445 // GlobalValues whenever they refer to a variable. Because we are in
3446 // the context of a function, getExistingVal will search the functions
3447 // symbol table instead of the module symbol table for the global symbol,
3448 // which throws things all off. To get around this, we just tell
3449 // getExistingVal that we are at global scope here.
3451 Function *SavedCurFn = CurFun.CurrentFunction;
3452 CurFun.CurrentFunction = 0;
3454 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3457 CurFun.CurrentFunction = SavedCurFn;
3459 // If this is an initializer for a constant pointer, which is referencing a
3460 // (currently) undefined variable, create a stub now that shall be replaced
3461 // in the future with the right type of variable.
3464 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3465 const PointerType *PT = cast<PointerType>(Ty);
3467 // First check to see if the forward references value is already created!
3468 PerModuleInfo::GlobalRefsType::iterator I =
3469 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3471 if (I != CurModule.GlobalRefs.end()) {
3472 V = I->second; // Placeholder already exists, use it...
3473 yyvsp[0].ValIDVal.destroy();
3476 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3477 Name = yyvsp[0].ValIDVal.getName();
3478 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3479 GEN_ERROR("Invalid reference to global");
3481 // Create the forward referenced global.
3483 if (const FunctionType *FTy =
3484 dyn_cast<FunctionType>(PT->getElementType())) {
3485 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3486 CurModule.CurrentModule);
3488 GV = new GlobalVariable(PT->getElementType(), false,
3489 GlobalValue::ExternalWeakLinkage, 0,
3490 Name, CurModule.CurrentModule);
3493 // Keep track of the fact that we have a forward ref to recycle it
3494 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3499 yyval.ConstVal = cast<GlobalValue>(V);
3500 delete yyvsp[-1].TypeVal; // Free the type handle
3505 #line 1807 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3507 if (!UpRefs.empty())
3508 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3509 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3510 GEN_ERROR("Mismatched types for constant expression: " +
3511 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3512 yyval.ConstVal = yyvsp[0].ConstVal;
3513 delete yyvsp[-1].TypeVal;
3518 #line 1817 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3520 if (!UpRefs.empty())
3521 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3522 const Type *Ty = yyvsp[-1].TypeVal->get();
3523 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3524 GEN_ERROR("Cannot create a null initialized value of this type");
3525 yyval.ConstVal = Constant::getNullValue(Ty);
3526 delete yyvsp[-1].TypeVal;
3531 #line 1827 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3532 { // integral constants
3533 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3534 GEN_ERROR("Constant value doesn't fit in type");
3535 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3540 #line 1833 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3541 { // arbitrary precision integer constants
3542 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3543 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3544 GEN_ERROR("Constant value does not fit in type");
3546 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3547 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3548 delete yyvsp[0].APIntVal;
3553 #line 1843 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3554 { // integral constants
3555 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3556 GEN_ERROR("Constant value doesn't fit in type");
3557 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3562 #line 1849 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3563 { // arbitrary precision integer constants
3564 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3565 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3566 GEN_ERROR("Constant value does not fit in type");
3568 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3569 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3570 delete yyvsp[0].APIntVal;
3575 #line 1859 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3576 { // Boolean constants
3577 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3578 yyval.ConstVal = ConstantInt::getTrue();
3583 #line 1864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3584 { // Boolean constants
3585 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3586 yyval.ConstVal = ConstantInt::getFalse();
3591 #line 1869 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3592 { // Floating point constants
3593 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
3594 GEN_ERROR("Floating point constant invalid for type");
3595 // Lexer has no type info, so builds all float and double FP constants
3596 // as double. Fix this here. Long double is done right.
3597 if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy)
3598 yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
3599 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
3600 delete yyvsp[0].FPVal;
3605 #line 1882 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3607 if (!UpRefs.empty())
3608 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3609 Constant *Val = yyvsp[-3].ConstVal;
3610 const Type *DestTy = yyvsp[-1].TypeVal->get();
3611 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3612 GEN_ERROR("invalid cast opcode for cast from '" +
3613 Val->getType()->getDescription() + "' to '" +
3614 DestTy->getDescription() + "'");
3615 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3616 delete yyvsp[-1].TypeVal;
3620 #line 1894 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3622 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3623 GEN_ERROR("GetElementPtr requires a pointer operand");
3626 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
3629 GEN_ERROR("Index list invalid for constant getelementptr");
3631 SmallVector<Constant*, 8> IdxVec;
3632 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3633 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3634 IdxVec.push_back(C);
3636 GEN_ERROR("Indices to constant getelementptr must be constants");
3638 delete yyvsp[-1].ValueList;
3640 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3645 #line 1916 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3647 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3648 GEN_ERROR("Select condition must be of boolean type");
3649 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3650 GEN_ERROR("Select operand types must match");
3651 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3656 #line 1924 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3658 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3659 GEN_ERROR("Binary operator types must match");
3661 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3665 #line 1930 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3667 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3668 GEN_ERROR("Logical operator types must match");
3669 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3670 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3671 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3672 GEN_ERROR("Logical operator requires integral operands");
3674 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3679 #line 1941 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3681 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3682 GEN_ERROR("icmp operand types must match");
3683 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3687 #line 1946 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3689 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3690 GEN_ERROR("fcmp operand types must match");
3691 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3695 #line 1951 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3697 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3698 GEN_ERROR("Invalid extractelement operands");
3699 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3704 #line 1957 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3706 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3707 GEN_ERROR("Invalid insertelement operands");
3708 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3713 #line 1963 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3715 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3716 GEN_ERROR("Invalid shufflevector operands");
3717 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3722 #line 1972 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3724 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3729 #line 1976 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3731 yyval.ConstVector = new std::vector<Constant*>();
3732 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3737 #line 1984 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3738 { yyval.BoolVal = false; ;
3741 #line 1984 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3742 { yyval.BoolVal = true; ;
3745 #line 1987 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3746 { yyval.BoolVal = true; ;
3749 #line 1987 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3750 { yyval.BoolVal = false; ;
3753 #line 1990 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3755 const Type* VTy = yyvsp[-1].TypeVal->get();
3756 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3758 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3760 GEN_ERROR("Aliases can be created only to global values");
3762 yyval.ConstVal = Aliasee;
3764 delete yyvsp[-1].TypeVal;
3768 #line 2002 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3770 Constant *Val = yyvsp[-3].ConstVal;
3771 const Type *DestTy = yyvsp[-1].TypeVal->get();
3772 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3773 GEN_ERROR("invalid cast opcode for cast from '" +
3774 Val->getType()->getDescription() + "' to '" +
3775 DestTy->getDescription() + "'");
3777 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3779 delete yyvsp[-1].TypeVal;
3783 #line 2023 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3785 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3786 CurModule.ModuleDone();
3791 #line 2028 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3793 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3794 CurModule.ModuleDone();
3799 #line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3800 { CurFun.isDeclare = false; ;
3803 #line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3805 CurFun.FunctionDone();
3810 #line 2045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3811 { CurFun.isDeclare = true; ;
3814 #line 2045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3820 #line 2048 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3826 #line 2051 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3828 if (!UpRefs.empty())
3829 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3830 // Eagerly resolve types. This is not an optimization, this is a
3831 // requirement that is due to the fact that we could have this:
3833 // %list = type { %list * }
3834 // %list = type { %list * } ; repeated type decl
3836 // If types are not resolved eagerly, then the two types will not be
3837 // determined to be the same type!
3839 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3841 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3843 // If this is a named type that is not a redefinition, add it to the slot
3845 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3848 delete yyvsp[0].TypeVal;
3853 #line 2075 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3855 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3857 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3859 // If this is a named type that is not a redefinition, add it to the slot
3861 CurModule.Types.push_back(yyvsp[0].PrimType);
3867 #line 2086 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3869 /* "Externally Visible" Linkage */
3870 if (yyvsp[0].ConstVal == 0)
3871 GEN_ERROR("Global value initializer is not a constant");
3872 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3873 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3878 #line 2093 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3884 #line 2097 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3886 if (yyvsp[0].ConstVal == 0)
3887 GEN_ERROR("Global value initializer is not a constant");
3888 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3893 #line 2102 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3899 #line 2106 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3901 if (!UpRefs.empty())
3902 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3903 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
3905 delete yyvsp[0].TypeVal;
3909 #line 2112 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3916 #line 2116 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3919 if (yyvsp[-4].StrVal) {
3920 Name = *yyvsp[-4].StrVal;
3921 delete yyvsp[-4].StrVal;
3924 GEN_ERROR("Alias name cannot be empty");
3926 Constant* Aliasee = yyvsp[0].ConstVal;
3928 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3930 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
3931 CurModule.CurrentModule);
3932 GA->setVisibility(yyvsp[-3].Visibility);
3933 InsertValue(GA, CurModule.Values);
3936 // If there was a forward reference of this alias, resolve it now.
3940 ID = ValID::createGlobalName(Name);
3942 ID = ValID::createGlobalID(CurModule.Values.size()-1);
3944 if (GlobalValue *FWGV =
3945 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
3946 // Replace uses of the fwdref with the actual alias.
3947 FWGV->replaceAllUsesWith(GA);
3948 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
3949 GV->eraseFromParent();
3951 cast<Function>(FWGV)->eraseFromParent();
3959 #line 2156 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3965 #line 2159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3971 #line 2165 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3973 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3974 if (AsmSoFar.empty())
3975 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
3977 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
3978 delete yyvsp[0].StrVal;
3983 #line 2175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3985 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
3986 delete yyvsp[0].StrVal;
3990 #line 2179 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3992 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
3993 delete yyvsp[0].StrVal;
3997 #line 2186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3999 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4000 delete yyvsp[0].StrVal;
4005 #line 2191 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4007 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4008 delete yyvsp[0].StrVal;
4013 #line 2196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4019 #line 2205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4021 if (!UpRefs.empty())
4022 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4023 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4024 GEN_ERROR("void typed arguments are invalid");
4025 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4026 yyval.ArgList = yyvsp[-4].ArgList;
4027 yyvsp[-4].ArgList->push_back(E);
4032 #line 2215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4034 if (!UpRefs.empty())
4035 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4036 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4037 GEN_ERROR("void typed arguments are invalid");
4038 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4039 yyval.ArgList = new ArgListType;
4040 yyval.ArgList->push_back(E);
4045 #line 2226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4047 yyval.ArgList = yyvsp[0].ArgList;
4052 #line 2230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4054 yyval.ArgList = yyvsp[-2].ArgList;
4055 struct ArgListEntry E;
4056 E.Ty = new PATypeHolder(Type::VoidTy);
4058 E.Attrs = ParamAttr::None;
4059 yyval.ArgList->push_back(E);
4064 #line 2239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4066 yyval.ArgList = new ArgListType;
4067 struct ArgListEntry E;
4068 E.Ty = new PATypeHolder(Type::VoidTy);
4070 E.Attrs = ParamAttr::None;
4071 yyval.ArgList->push_back(E);
4076 #line 2248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4083 #line 2254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4085 std::string FunctionName(*yyvsp[-6].StrVal);
4086 delete yyvsp[-6].StrVal; // Free strdup'd memory!
4088 // Check the function result for abstractness if this is a define. We should
4089 // have no abstract types at this point
4090 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4091 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4093 std::vector<const Type*> ParamTypeList;
4094 ParamAttrsVector Attrs;
4095 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4096 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4097 Attrs.push_back(PAWI);
4099 if (yyvsp[-4].ArgList) { // If there are arguments...
4101 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4102 const Type* Ty = I->Ty->get();
4103 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4104 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4105 ParamTypeList.push_back(Ty);
4106 if (Ty != Type::VoidTy)
4107 if (I->Attrs != ParamAttr::None) {
4108 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4109 Attrs.push_back(PAWI);
4114 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4115 if (isVarArg) ParamTypeList.pop_back();
4117 ParamAttrsList *PAL = 0;
4119 PAL = ParamAttrsList::get(Attrs);
4121 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4122 const PointerType *PFT = PointerType::get(FT);
4123 delete yyvsp[-7].TypeVal;
4126 if (!FunctionName.empty()) {
4127 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4129 ID = ValID::createGlobalID(CurModule.Values.size());
4133 // See if this function was forward referenced. If so, recycle the object.
4134 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4135 // Move the function to the end of the list, from whereever it was
4136 // previously inserted.
4137 Fn = cast<Function>(FWRef);
4138 CurModule.CurrentModule->getFunctionList().remove(Fn);
4139 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4140 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4141 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4142 if (Fn->getFunctionType() != FT) {
4143 // The existing function doesn't have the same type. This is an overload
4145 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4146 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4147 // Neither the existing or the current function is a declaration and they
4148 // have the same name and same type. Clearly this is a redefinition.
4149 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4150 } if (Fn->isDeclaration()) {
4151 // Make sure to strip off any argument names so we can't get conflicts.
4152 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4156 } else { // Not already defined?
4157 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4158 CurModule.CurrentModule);
4160 InsertValue(Fn, CurModule.Values);
4163 CurFun.FunctionStart(Fn);
4165 if (CurFun.isDeclare) {
4166 // If we have declaration, always overwrite linkage. This will allow us to
4167 // correctly handle cases, when pointer to function is passed as argument to
4168 // another function.
4169 Fn->setLinkage(CurFun.Linkage);
4170 Fn->setVisibility(CurFun.Visibility);
4172 Fn->setCallingConv(yyvsp[-8].UIntVal);
4173 Fn->setAlignment(yyvsp[0].UIntVal);
4174 if (yyvsp[-1].StrVal) {
4175 Fn->setSection(*yyvsp[-1].StrVal);
4176 delete yyvsp[-1].StrVal;
4179 // Add all of the arguments we parsed to the function...
4180 if (yyvsp[-4].ArgList) { // Is null if empty...
4181 if (isVarArg) { // Nuke the last entry
4182 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4183 "Not a varargs marker!");
4184 delete yyvsp[-4].ArgList->back().Ty;
4185 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4187 Function::arg_iterator ArgIt = Fn->arg_begin();
4188 Function::arg_iterator ArgEnd = Fn->arg_end();
4190 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4191 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4192 delete I->Ty; // Delete the typeholder...
4193 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4199 delete yyvsp[-4].ArgList; // We're now done with the argument list
4205 #line 2376 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4207 yyval.FunctionVal = CurFun.CurrentFunction;
4209 // Make sure that we keep track of the linkage type even if there was a
4210 // previous "declare".
4211 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4212 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4216 #line 2387 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4218 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4223 #line 2392 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4225 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4226 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4227 yyval.FunctionVal = CurFun.CurrentFunction;
4228 CurFun.FunctionDone();
4233 #line 2404 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4235 yyval.BoolVal = false;
4240 #line 2408 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4242 yyval.BoolVal = true;
4247 #line 2413 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4248 { // A reference to a direct constant
4249 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4254 #line 2417 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4256 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4261 #line 2421 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4262 { // Perhaps it's an FP constant?
4263 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4268 #line 2425 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4270 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4275 #line 2429 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4277 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4282 #line 2433 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4284 yyval.ValIDVal = ValID::createNull();
4289 #line 2437 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4291 yyval.ValIDVal = ValID::createUndef();
4296 #line 2441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4297 { // A vector zero constant.
4298 yyval.ValIDVal = ValID::createZeroInit();
4303 #line 2445 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4304 { // Nonempty unsized packed vector
4305 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4306 int NumElements = yyvsp[-1].ConstVector->size();
4308 VectorType* pt = VectorType::get(ETy, NumElements);
4309 PATypeHolder* PTy = new PATypeHolder(
4317 // Verify all elements are correct type!
4318 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4319 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4320 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4321 ETy->getDescription() +"' as required!\nIt is of type '" +
4322 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4325 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4326 delete PTy; delete yyvsp[-1].ConstVector;
4331 #line 2470 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4333 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4338 #line 2474 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4340 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4341 delete yyvsp[-2].StrVal;
4342 delete yyvsp[0].StrVal;
4347 #line 2484 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4348 { // Is it an integer reference...?
4349 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4354 #line 2488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4356 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4361 #line 2492 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4362 { // Is it a named reference...?
4363 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4364 delete yyvsp[0].StrVal;
4369 #line 2497 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4370 { // Is it a named reference...?
4371 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4372 delete yyvsp[0].StrVal;
4377 #line 2510 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4379 if (!UpRefs.empty())
4380 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4381 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4382 delete yyvsp[-1].TypeVal;
4387 #line 2519 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4389 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4394 #line 2523 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4395 { // Do not allow functions with 0 basic blocks
4396 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4401 #line 2532 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4403 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4405 InsertValue(yyvsp[0].TermInstVal);
4406 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4407 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4412 #line 2541 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4414 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4415 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4416 if (CI2->getParent() == 0)
4417 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4418 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4419 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4424 #line 2550 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4425 { // Empty space between instruction lists
4426 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4431 #line 2554 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4432 { // Labelled (named) basic block
4433 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4434 delete yyvsp[0].StrVal;
4440 #line 2561 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4441 { // Return with a result...
4442 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4447 #line 2565 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4448 { // Return with no result...
4449 yyval.TermInstVal = new ReturnInst();
4454 #line 2569 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4455 { // Unconditional Branch...
4456 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4458 yyval.TermInstVal = new BranchInst(tmpBB);
4462 #line 2574 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4464 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4465 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4467 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4469 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4471 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4475 #line 2584 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4477 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4479 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4481 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4482 yyval.TermInstVal = S;
4484 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4485 E = yyvsp[-1].JumpTable->end();
4486 for (; I != E; ++I) {
4487 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4488 S->addCase(CI, I->second);
4490 GEN_ERROR("Switch case is constant, but not a simple integer");
4492 delete yyvsp[-1].JumpTable;
4497 #line 2603 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4499 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4501 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4503 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4504 yyval.TermInstVal = S;
4509 #line 2613 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4512 // Handle the short syntax
4513 const PointerType *PFTy = 0;
4514 const FunctionType *Ty = 0;
4515 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4516 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4517 // Pull out the types of all of the arguments...
4518 std::vector<const Type*> ParamTypes;
4519 ParamAttrsVector Attrs;
4520 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4521 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4522 Attrs.push_back(PAWI);
4524 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
4526 for (; I != E; ++I, ++index) {
4527 const Type *Ty = I->Val->getType();
4528 if (Ty == Type::VoidTy)
4529 GEN_ERROR("Short call syntax cannot be used with varargs");
4530 ParamTypes.push_back(Ty);
4531 if (I->Attrs != ParamAttr::None) {
4532 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4533 Attrs.push_back(PAWI);
4537 ParamAttrsList *PAL = 0;
4539 PAL = ParamAttrsList::get(Attrs);
4540 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
4541 PFTy = PointerType::get(Ty);
4544 delete yyvsp[-11].TypeVal;
4546 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4548 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4550 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4553 // Check the arguments
4555 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
4556 // Make sure no arguments is a good thing!
4557 if (Ty->getNumParams() != 0)
4558 GEN_ERROR("No arguments passed to a function that "
4559 "expects arguments");
4560 } else { // Has arguments?
4561 // Loop through FunctionType's arguments and ensure they are specified
4563 FunctionType::param_iterator I = Ty->param_begin();
4564 FunctionType::param_iterator E = Ty->param_end();
4565 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
4567 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4568 if (ArgI->Val->getType() != *I)
4569 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4570 (*I)->getDescription() + "'");
4571 Args.push_back(ArgI->Val);
4574 if (Ty->isVarArg()) {
4576 for (; ArgI != ArgE; ++ArgI)
4577 Args.push_back(ArgI->Val); // push the remaining varargs
4578 } else if (I != E || ArgI != ArgE)
4579 GEN_ERROR("Invalid number of parameters detected");
4582 // Create the InvokeInst
4583 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
4584 II->setCallingConv(yyvsp[-12].UIntVal);
4585 yyval.TermInstVal = II;
4586 delete yyvsp[-8].ValueRefList;
4591 #line 2692 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4593 yyval.TermInstVal = new UnwindInst();
4598 #line 2696 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4600 yyval.TermInstVal = new UnreachableInst();
4605 #line 2703 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4607 yyval.JumpTable = yyvsp[-5].JumpTable;
4608 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4611 GEN_ERROR("May only switch on a constant pool value");
4613 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4615 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4619 #line 2714 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4621 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4622 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4626 GEN_ERROR("May only switch on a constant pool value");
4628 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4630 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4634 #line 2727 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4636 // Is this definition named?? if so, assign the name...
4637 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4639 InsertValue(yyvsp[0].InstVal);
4640 yyval.InstVal = yyvsp[0].InstVal;
4645 #line 2737 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4646 { // Used for PHI nodes
4647 if (!UpRefs.empty())
4648 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4649 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4650 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4652 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4654 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4655 delete yyvsp[-5].TypeVal;
4659 #line 2748 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4661 yyval.PHIList = yyvsp[-6].PHIList;
4662 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4664 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4666 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4670 #line 2758 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4672 if (!UpRefs.empty())
4673 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4674 // Used for call and invoke instructions
4675 yyval.ValueRefList = new ValueRefList();
4676 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4677 yyval.ValueRefList->push_back(E);
4678 delete yyvsp[-2].TypeVal;
4682 #line 2767 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4684 if (!UpRefs.empty())
4685 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4686 yyval.ValueRefList = yyvsp[-4].ValueRefList;
4687 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4688 yyval.ValueRefList->push_back(E);
4689 delete yyvsp[-2].TypeVal;
4694 #line 2776 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4695 { yyval.ValueRefList = new ValueRefList(); ;
4698 #line 2779 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4699 { yyval.ValueList = new std::vector<Value*>(); ;
4702 #line 2780 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4704 yyval.ValueList = yyvsp[-2].ValueList;
4705 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4710 #line 2787 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4712 yyval.BoolVal = true;
4717 #line 2791 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4719 yyval.BoolVal = false;
4724 #line 2796 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4726 if (!UpRefs.empty())
4727 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4728 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4729 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4731 "Arithmetic operator requires integer, FP, or packed operands");
4732 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4733 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4734 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4735 yyvsp[-4].BinaryOpVal == Instruction::FRem))
4736 GEN_ERROR("Remainder not supported on vector types");
4737 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4739 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4741 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4742 if (yyval.InstVal == 0)
4743 GEN_ERROR("binary operator returned null");
4744 delete yyvsp[-3].TypeVal;
4748 #line 2817 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4750 if (!UpRefs.empty())
4751 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4752 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4753 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4754 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4755 GEN_ERROR("Logical operator requires integral operands");
4757 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4759 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4761 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4762 if (yyval.InstVal == 0)
4763 GEN_ERROR("binary operator returned null");
4764 delete yyvsp[-3].TypeVal;
4768 #line 2834 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4770 if (!UpRefs.empty())
4771 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4772 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4773 GEN_ERROR("Vector types not supported by icmp instruction");
4774 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4776 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4778 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4779 if (yyval.InstVal == 0)
4780 GEN_ERROR("icmp operator returned null");
4781 delete yyvsp[-3].TypeVal;
4785 #line 2848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4787 if (!UpRefs.empty())
4788 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4789 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4790 GEN_ERROR("Vector types not supported by fcmp instruction");
4791 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4793 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4795 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4796 if (yyval.InstVal == 0)
4797 GEN_ERROR("fcmp operator returned null");
4798 delete yyvsp[-3].TypeVal;
4802 #line 2862 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4804 if (!UpRefs.empty())
4805 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4806 Value* Val = yyvsp[-2].ValueVal;
4807 const Type* DestTy = yyvsp[0].TypeVal->get();
4808 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4809 GEN_ERROR("invalid cast opcode for cast from '" +
4810 Val->getType()->getDescription() + "' to '" +
4811 DestTy->getDescription() + "'");
4812 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4813 delete yyvsp[0].TypeVal;
4817 #line 2874 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4819 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4820 GEN_ERROR("select condition must be boolean");
4821 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4822 GEN_ERROR("select value types should match");
4823 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4828 #line 2882 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4830 if (!UpRefs.empty())
4831 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4832 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4833 delete yyvsp[0].TypeVal;
4838 #line 2889 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4840 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4841 GEN_ERROR("Invalid extractelement operands");
4842 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4847 #line 2895 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4849 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4850 GEN_ERROR("Invalid insertelement operands");
4851 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4856 #line 2901 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4858 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4859 GEN_ERROR("Invalid shufflevector operands");
4860 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4865 #line 2907 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4867 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4868 if (!Ty->isFirstClassType())
4869 GEN_ERROR("PHI node operands must be of first class type");
4870 yyval.InstVal = new PHINode(Ty);
4871 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4872 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4873 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4874 GEN_ERROR("All elements of a PHI node must be of the same type");
4875 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4876 yyvsp[0].PHIList->pop_front();
4878 delete yyvsp[0].PHIList; // Free the list...
4883 #line 2923 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4886 // Handle the short syntax
4887 const PointerType *PFTy = 0;
4888 const FunctionType *Ty = 0;
4889 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
4890 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4891 // Pull out the types of all of the arguments...
4892 std::vector<const Type*> ParamTypes;
4893 ParamAttrsVector Attrs;
4894 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4895 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
4896 Attrs.push_back(PAWI);
4899 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
4900 for (; I != E; ++I, ++index) {
4901 const Type *Ty = I->Val->getType();
4902 if (Ty == Type::VoidTy)
4903 GEN_ERROR("Short call syntax cannot be used with varargs");
4904 ParamTypes.push_back(Ty);
4905 if (I->Attrs != ParamAttr::None) {
4906 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4907 Attrs.push_back(PAWI);
4911 ParamAttrsList *PAL = 0;
4913 PAL = ParamAttrsList::get(Attrs);
4915 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
4916 PFTy = PointerType::get(Ty);
4919 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
4922 // Check for call to invalid intrinsic to avoid crashing later.
4923 if (Function *theF = dyn_cast<Function>(V)) {
4924 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4925 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4926 !theF->getIntrinsicID(true))
4927 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4928 theF->getName() + "'");
4931 // Check the arguments
4933 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
4934 // Make sure no arguments is a good thing!
4935 if (Ty->getNumParams() != 0)
4936 GEN_ERROR("No arguments passed to a function that "
4937 "expects arguments");
4938 } else { // Has arguments?
4939 // Loop through FunctionType's arguments and ensure they are specified
4942 FunctionType::param_iterator I = Ty->param_begin();
4943 FunctionType::param_iterator E = Ty->param_end();
4944 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
4946 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4947 if (ArgI->Val->getType() != *I)
4948 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4949 (*I)->getDescription() + "'");
4950 Args.push_back(ArgI->Val);
4952 if (Ty->isVarArg()) {
4954 for (; ArgI != ArgE; ++ArgI)
4955 Args.push_back(ArgI->Val); // push the remaining varargs
4956 } else if (I != E || ArgI != ArgE)
4957 GEN_ERROR("Invalid number of parameters detected");
4959 // Create the call node
4960 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
4961 CI->setTailCall(yyvsp[-7].BoolVal);
4962 CI->setCallingConv(yyvsp[-6].UIntVal);
4964 delete yyvsp[-2].ValueRefList;
4965 delete yyvsp[-5].TypeVal;
4970 #line 3007 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4972 yyval.InstVal = yyvsp[0].InstVal;
4977 #line 3012 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4979 yyval.BoolVal = true;
4984 #line 3016 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4986 yyval.BoolVal = false;
4991 #line 3023 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4993 if (!UpRefs.empty())
4994 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4995 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4996 delete yyvsp[-1].TypeVal;
5001 #line 3030 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5003 if (!UpRefs.empty())
5004 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5005 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5007 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5008 delete yyvsp[-4].TypeVal;
5012 #line 3038 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5014 if (!UpRefs.empty())
5015 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5016 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5017 delete yyvsp[-1].TypeVal;
5022 #line 3045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5024 if (!UpRefs.empty())
5025 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5026 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5028 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5029 delete yyvsp[-4].TypeVal;
5033 #line 3053 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5035 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5036 GEN_ERROR("Trying to free nonpointer type " +
5037 yyvsp[0].ValueVal->getType()->getDescription() + "");
5038 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5043 #line 3061 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5045 if (!UpRefs.empty())
5046 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5047 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5048 GEN_ERROR("Can't load from nonpointer type: " +
5049 (*yyvsp[-2].TypeVal)->getDescription());
5050 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5051 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5052 (*yyvsp[-2].TypeVal)->getDescription());
5053 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5055 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5056 delete yyvsp[-2].TypeVal;
5060 #line 3075 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5062 if (!UpRefs.empty())
5063 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5064 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5066 GEN_ERROR("Can't store to a nonpointer type: " +
5067 (*yyvsp[-2].TypeVal)->getDescription());
5068 const Type *ElTy = PT->getElementType();
5069 if (ElTy != yyvsp[-4].ValueVal->getType())
5070 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5071 "' into space of type '" + ElTy->getDescription() + "'");
5073 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5075 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5076 delete yyvsp[-2].TypeVal;
5080 #line 3092 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5082 if (!UpRefs.empty())
5083 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5084 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5085 GEN_ERROR("getelementptr insn requires pointer operand");
5087 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
5088 GEN_ERROR("Invalid getelementptr indices for type '" +
5089 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5090 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5092 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
5093 delete yyvsp[-2].TypeVal;
5094 delete yyvsp[0].ValueList;
5098 /* the action file gets copied in in place of this dollarsign */
5099 #line 543 "/usr/share/bison.simple"
5110 short *ssp1 = yyss - 1;
5111 fprintf (stderr, "state stack now");
5112 while (ssp1 != yyssp)
5113 fprintf (stderr, " %d", *++ssp1);
5114 fprintf (stderr, "\n");
5124 yylsp->first_line = yylloc.first_line;
5125 yylsp->first_column = yylloc.first_column;
5126 yylsp->last_line = (yylsp-1)->last_line;
5127 yylsp->last_column = (yylsp-1)->last_column;
5132 yylsp->last_line = (yylsp+yylen-1)->last_line;
5133 yylsp->last_column = (yylsp+yylen-1)->last_column;
5137 /* Now "shift" the result of the reduction.
5138 Determine what state that goes to,
5139 based on the state we popped back to
5140 and the rule number reduced by. */
5144 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5145 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5146 yystate = yytable[yystate];
5148 yystate = yydefgoto[yyn - YYNTBASE];
5152 yyerrlab: /* here on detecting error */
5155 /* If not already recovering from an error, report this error. */
5159 #ifdef YYERROR_VERBOSE
5160 yyn = yypact[yystate];
5162 if (yyn > YYFLAG && yyn < YYLAST)
5169 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5170 for (x = (yyn < 0 ? -yyn : 0);
5171 x < (sizeof(yytname) / sizeof(char *)); x++)
5172 if (yycheck[x + yyn] == x)
5173 size += strlen(yytname[x]) + 15, count++;
5174 msg = (char *) malloc(size + 15);
5177 strcpy(msg, "parse error");
5182 for (x = (yyn < 0 ? -yyn : 0);
5183 x < (sizeof(yytname) / sizeof(char *)); x++)
5184 if (yycheck[x + yyn] == x)
5186 strcat(msg, count == 0 ? ", expecting `" : " or `");
5187 strcat(msg, yytname[x]);
5196 yyerror ("parse error; also virtual memory exceeded");
5199 #endif /* YYERROR_VERBOSE */
5200 yyerror("parse error");
5204 yyerrlab1: /* here on error raised explicitly by an action */
5206 if (yyerrstatus == 3)
5208 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5210 /* return failure if at end of input */
5211 if (yychar == YYEOF)
5216 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5222 /* Else will try to reuse lookahead token
5223 after shifting the error token. */
5225 yyerrstatus = 3; /* Each real token shifted decrements this */
5229 yyerrdefault: /* current state does not do anything special for the error token. */
5232 /* This is wrong; only states that explicitly want error tokens
5233 should shift them. */
5234 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5235 if (yyn) goto yydefault;
5238 yyerrpop: /* pop the current state because it cannot handle the error token */
5240 if (yyssp == yyss) YYABORT;
5250 short *ssp1 = yyss - 1;
5251 fprintf (stderr, "Error: state stack now");
5252 while (ssp1 != yyssp)
5253 fprintf (stderr, " %d", *++ssp1);
5254 fprintf (stderr, "\n");
5260 yyn = yypact[yystate];
5265 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5284 fprintf(stderr, "Shifting error token, ");
5296 /* YYACCEPT comes here. */
5308 /* YYABORT comes here. */
5319 #line 3109 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5322 // common code from the two 'RunVMAsmParser' functions
5323 static Module* RunParser(Module * M) {
5325 llvmAsmlineno = 1; // Reset the current line number...
5326 CurModule.CurrentModule = M;
5331 // Check to make sure the parser succeeded
5334 delete ParserResult;
5338 // Emit an error if there are any unresolved types left.
5339 if (!CurModule.LateResolveTypes.empty()) {
5340 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5341 if (DID.Type == ValID::LocalName) {
5342 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5344 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5347 delete ParserResult;
5351 // Emit an error if there are any unresolved values left.
5352 if (!CurModule.LateResolveValues.empty()) {
5353 Value *V = CurModule.LateResolveValues.back();
5354 std::map<Value*, std::pair<ValID, int> >::iterator I =
5355 CurModule.PlaceHolderInfo.find(V);
5357 if (I != CurModule.PlaceHolderInfo.end()) {
5358 ValID &DID = I->second.first;
5359 if (DID.Type == ValID::LocalName) {
5360 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5362 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5365 delete ParserResult;
5370 // Check to make sure that parsing produced a result
5374 // Reset ParserResult variable while saving its value for the result.
5375 Module *Result = ParserResult;
5381 void llvm::GenerateError(const std::string &message, int LineNo) {
5382 if (LineNo == -1) LineNo = llvmAsmlineno;
5383 // TODO: column number in exception
5385 TheParseError->setError(CurFilename, message, LineNo);
5389 int yyerror(const char *ErrorMsg) {
5391 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5392 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5393 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5394 if (yychar != YYEMPTY && yychar != 0)
5395 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5397 GenerateError(errMsg);