2 /* A Bison parser, made from /Volumes/MacOS9/gcc/llvm-gcc-main/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-gcc-main/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-gcc-main/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::ParamList *ParamList;
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, 829, 835, 841, 842, 843, 847, 850, 852, 858,
1249 864, 871, 878, 883, 890, 895, 900, 907, 914, 917,
1250 926, 928, 930, 931, 935, 942, 946, 953, 956, 962,
1254 static const short yyrhs[] = { 73,
1255 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1256 0, 79, 0, 80, 0, 81, 0, 85, 0, 86,
1257 0, 87, 0, 82, 0, 83, 0, 84, 0, 116,
1258 0, 117, 0, 118, 0, 119, 0, 120, 0, 121,
1259 0, 122, 0, 123, 0, 124, 0, 125, 0, 126,
1260 0, 127, 0, 90, 0, 91, 0, 92, 0, 93,
1261 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
1262 0, 99, 0, 100, 0, 101, 0, 102, 0, 103,
1263 0, 104, 0, 105, 0, 106, 0, 107, 0, 108,
1264 0, 109, 0, 96, 0, 97, 0, 98, 0, 99,
1265 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1266 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1267 0, 24, 0, 167, 0, 0, 167, 146, 0, 0,
1268 20, 0, 23, 0, 172, 0, 0, 170, 146, 0,
1269 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1270 46, 0, 48, 0, 50, 0, 0, 143, 0, 144,
1271 0, 145, 0, 0, 46, 0, 48, 0, 0, 42,
1272 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1273 42, 0, 0, 61, 0, 62, 0, 63, 0, 64,
1274 0, 65, 0, 60, 4, 0, 135, 0, 117, 0,
1275 134, 0, 118, 0, 137, 0, 138, 0, 140, 0,
1276 141, 0, 142, 0, 0, 181, 180, 0, 136, 0,
1277 139, 0, 135, 0, 134, 0, 0, 183, 182, 0,
1278 0, 53, 4, 0, 0, 147, 53, 4, 0, 34,
1279 22, 0, 0, 186, 0, 0, 147, 189, 188, 0,
1280 186, 0, 53, 4, 0, 11, 0, 12, 0, 13,
1281 0, 16, 0, 15, 0, 14, 0, 17, 0, 49,
1282 0, 190, 0, 191, 148, 0, 225, 0, 149, 4,
1283 0, 191, 150, 195, 151, 183, 0, 10, 150, 195,
1284 151, 183, 0, 152, 4, 153, 191, 154, 0, 155,
1285 4, 153, 191, 156, 0, 157, 196, 158, 0, 157,
1286 158, 0, 155, 157, 196, 158, 156, 0, 155, 157,
1287 158, 156, 0, 191, 181, 0, 191, 0, 10, 0,
1288 192, 0, 194, 147, 192, 0, 194, 0, 194, 147,
1289 39, 0, 39, 0, 0, 191, 0, 196, 147, 191,
1290 0, 191, 152, 199, 154, 0, 191, 152, 154, 0,
1291 191, 159, 22, 0, 191, 155, 199, 156, 0, 191,
1292 157, 199, 158, 0, 191, 157, 158, 0, 191, 155,
1293 157, 199, 158, 156, 0, 191, 155, 157, 158, 156,
1294 0, 191, 40, 0, 191, 41, 0, 191, 225, 0,
1295 191, 198, 0, 191, 25, 0, 165, 3, 0, 165,
1296 5, 0, 165, 4, 0, 165, 6, 0, 11, 26,
1297 0, 11, 27, 0, 166, 9, 0, 162, 150, 197,
1298 38, 191, 151, 0, 115, 150, 197, 236, 151, 0,
1299 129, 150, 197, 147, 197, 147, 197, 151, 0, 160,
1300 150, 197, 147, 197, 151, 0, 161, 150, 197, 147,
1301 197, 151, 0, 88, 163, 150, 197, 147, 197, 151,
1302 0, 89, 164, 150, 197, 147, 197, 151, 0, 131,
1303 150, 197, 147, 197, 151, 0, 132, 150, 197, 147,
1304 197, 147, 197, 151, 0, 133, 150, 197, 147, 197,
1305 147, 197, 151, 0, 199, 147, 197, 0, 197, 0,
1306 32, 0, 33, 0, 37, 0, 0, 193, 225, 0,
1307 121, 150, 202, 38, 191, 151, 0, 204, 0, 0,
1308 205, 0, 204, 205, 0, 0, 31, 206, 221, 0,
1309 0, 30, 207, 222, 0, 58, 57, 211, 0, 169,
1310 18, 191, 0, 169, 18, 10, 0, 0, 171, 175,
1311 201, 200, 197, 208, 188, 0, 0, 171, 173, 175,
1312 201, 200, 197, 209, 188, 0, 0, 171, 174, 175,
1313 201, 200, 191, 210, 188, 0, 171, 175, 35, 178,
1314 202, 0, 51, 212, 0, 54, 146, 213, 0, 22,
1315 0, 52, 146, 22, 0, 66, 146, 22, 0, 152,
1316 214, 154, 0, 214, 147, 22, 0, 22, 0, 0,
1317 215, 147, 191, 181, 168, 0, 191, 181, 168, 0,
1318 215, 0, 215, 147, 39, 0, 39, 0, 0, 179,
1319 193, 170, 150, 216, 151, 183, 187, 184, 0, 28,
1320 0, 157, 0, 177, 175, 217, 218, 0, 29, 0,
1321 158, 0, 228, 220, 0, 176, 175, 217, 0, 0,
1322 59, 0, 3, 0, 4, 0, 9, 0, 26, 0,
1323 27, 0, 40, 0, 41, 0, 25, 0, 155, 199,
1324 156, 0, 198, 0, 57, 223, 22, 147, 22, 0,
1325 7, 0, 8, 0, 167, 0, 170, 0, 225, 0,
1326 224, 0, 191, 226, 0, 228, 229, 0, 219, 229,
1327 0, 230, 169, 231, 0, 230, 233, 0, 0, 21,
1328 0, 67, 227, 0, 67, 10, 0, 68, 17, 226,
1329 0, 68, 11, 226, 147, 17, 226, 147, 17, 226,
1330 0, 69, 165, 226, 147, 17, 226, 152, 232, 154,
1331 0, 69, 165, 226, 147, 17, 226, 152, 154, 0,
1332 70, 179, 193, 226, 150, 235, 151, 183, 38, 17,
1333 226, 71, 17, 226, 0, 71, 0, 72, 0, 232,
1334 165, 224, 147, 17, 226, 0, 165, 224, 147, 17,
1335 226, 0, 169, 238, 0, 191, 152, 226, 147, 226,
1336 154, 0, 234, 147, 152, 226, 147, 226, 154, 0,
1337 191, 226, 181, 0, 17, 226, 181, 0, 235, 147,
1338 191, 226, 181, 0, 235, 147, 17, 226, 181, 0,
1339 0, 0, 236, 147, 227, 0, 56, 55, 0, 55,
1340 0, 160, 191, 226, 147, 226, 0, 161, 191, 226,
1341 147, 226, 0, 88, 163, 191, 226, 147, 226, 0,
1342 89, 164, 191, 226, 147, 226, 0, 162, 227, 38,
1343 191, 0, 129, 227, 147, 227, 147, 227, 0, 130,
1344 227, 147, 191, 0, 131, 227, 147, 227, 0, 132,
1345 227, 147, 227, 147, 227, 0, 133, 227, 147, 227,
1346 147, 227, 0, 128, 234, 0, 237, 179, 193, 226,
1347 150, 235, 151, 183, 0, 240, 0, 36, 0, 0,
1348 110, 191, 185, 0, 110, 191, 147, 11, 226, 185,
1349 0, 111, 191, 185, 0, 111, 191, 147, 11, 226,
1350 185, 0, 112, 227, 0, 239, 113, 191, 226, 185,
1351 0, 239, 114, 227, 147, 191, 226, 185, 0, 115,
1358 static const short yyrline[] = { 0,
1359 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1128,
1360 1128, 1128, 1128, 1128, 1128, 1129, 1129, 1129, 1129, 1129,
1361 1129, 1129, 1130, 1130, 1130, 1130, 1130, 1133, 1133, 1134,
1362 1134, 1135, 1135, 1136, 1136, 1137, 1137, 1141, 1141, 1142,
1363 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1147,
1364 1147, 1148, 1149, 1154, 1155, 1155, 1155, 1155, 1155, 1157,
1365 1157, 1157, 1158, 1158, 1162, 1166, 1171, 1171, 1173, 1174,
1366 1179, 1185, 1186, 1187, 1188, 1189, 1193, 1194, 1195, 1199,
1367 1200, 1201, 1202, 1206, 1207, 1208, 1212, 1213, 1214, 1215,
1368 1216, 1220, 1221, 1222, 1225, 1225, 1226, 1227, 1228, 1229,
1369 1230, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246,
1370 1249, 1250, 1255, 1256, 1257, 1258, 1261, 1262, 1269, 1269,
1371 1276, 1276, 1285, 1293, 1293, 1299, 1299, 1301, 1306, 1319,
1372 1319, 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337,
1373 1342, 1350, 1380, 1411, 1416, 1428, 1438, 1442, 1452, 1459,
1374 1466, 1473, 1478, 1483, 1490, 1491, 1498, 1505, 1513, 1519,
1375 1531, 1559, 1575, 1602, 1630, 1656, 1676, 1702, 1722, 1734,
1376 1741, 1807, 1817, 1827, 1833, 1843, 1849, 1859, 1864, 1869,
1377 1882, 1894, 1916, 1924, 1930, 1941, 1946, 1951, 1957, 1963,
1378 1972, 1976, 1984, 1984, 1987, 1987, 1990, 2002, 2023, 2028,
1379 2036, 2037, 2041, 2041, 2045, 2045, 2048, 2051, 2075, 2086,
1380 2093, 2096, 2102, 2105, 2112, 2116, 2156, 2159, 2165, 2175,
1381 2179, 2184, 2186, 2191, 2196, 2205, 2215, 2226, 2230, 2239,
1382 2248, 2253, 2374, 2374, 2376, 2385, 2385, 2387, 2392, 2404,
1383 2408, 2413, 2417, 2421, 2425, 2429, 2433, 2437, 2441, 2445,
1384 2470, 2474, 2484, 2488, 2492, 2497, 2504, 2504, 2510, 2519,
1385 2523, 2532, 2541, 2550, 2554, 2561, 2565, 2569, 2574, 2584,
1386 2603, 2612, 2692, 2696, 2703, 2714, 2727, 2737, 2748, 2758,
1387 2767, 2773, 2782, 2788, 2791, 2792, 2799, 2803, 2808, 2829,
1388 2846, 2860, 2874, 2886, 2894, 2901, 2907, 2913, 2919, 2934,
1389 3019, 3024, 3028, 3035, 3042, 3050, 3057, 3065, 3073, 3087,
1395 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1397 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1398 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1399 "VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1400 "LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1401 "ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1402 "GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1403 "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1404 "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL",
1405 "TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1406 "X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE",
1407 "UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM",
1408 "FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT",
1409 "SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD",
1410 "UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC",
1411 "ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI",
1412 "INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT",
1413 "SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET","NOUNWIND","NOALIAS",
1414 "BYVAL","NEST","DEFAULT","HIDDEN","PROTECTED","'='","','","'*'","'\\\\'","'('",
1415 "')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps",
1416 "CastOps","IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName",
1417 "OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage",
1418 "GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage",
1419 "AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs",
1420 "OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1421 "PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1422 "ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1423 "Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1424 "LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1425 "FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1426 "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1427 "BBTerminatorInst","JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall",
1428 "InstVal","OptVolatile","MemoryInst", NULL
1432 static const short yyr1[] = { 0,
1433 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1434 161, 161, 161, 161, 161, 162, 162, 162, 162, 162,
1435 162, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1436 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
1437 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1438 164, 164, 164, 165, 166, 166, 166, 166, 166, 167,
1439 167, 167, 168, 168, 169, 169, 170, 170, 171, 171,
1440 172, 173, 173, 173, 173, 173, 174, 174, 174, 175,
1441 175, 175, 175, 176, 176, 176, 177, 177, 177, 177,
1442 177, 178, 178, 178, 179, 179, 179, 179, 179, 179,
1443 179, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1444 181, 181, 182, 182, 182, 182, 183, 183, 184, 184,
1445 185, 185, 186, 187, 187, 188, 188, 189, 189, 190,
1446 190, 190, 190, 190, 190, 190, 191, 191, 191, 191,
1447 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1448 193, 193, 194, 194, 195, 195, 195, 195, 196, 196,
1449 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1450 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1451 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1452 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1453 204, 204, 206, 205, 207, 205, 205, 205, 205, 208,
1454 205, 209, 205, 210, 205, 205, 205, 205, 211, 212,
1455 212, 213, 214, 214, 214, 215, 215, 216, 216, 216,
1456 216, 217, 218, 218, 219, 220, 220, 221, 222, 223,
1457 223, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1458 224, 224, 225, 225, 225, 225, 226, 226, 227, 228,
1459 228, 229, 230, 230, 230, 231, 231, 231, 231, 231,
1460 231, 231, 231, 231, 232, 232, 233, 234, 234, 235,
1461 235, 235, 235, 235, 236, 236, 237, 237, 238, 238,
1462 238, 238, 238, 238, 238, 238, 238, 238, 238, 238,
1463 238, 239, 239, 240, 240, 240, 240, 240, 240, 240,
1467 static const short yyr2[] = { 0,
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, 1, 1, 1, 1, 1, 1, 1,
1471 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1472 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1473 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1474 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1475 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1476 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1477 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1478 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1479 0, 2, 1, 1, 1, 1, 0, 2, 0, 2,
1480 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
1481 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1482 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1483 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1484 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1486 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1487 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1488 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1489 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1490 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1491 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1492 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1493 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1494 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1495 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1496 3, 5, 5, 0, 0, 3, 2, 1, 5, 5,
1497 6, 6, 4, 6, 4, 4, 6, 6, 2, 8,
1498 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
1502 static const short yydefact[] = { 70,
1503 60, 67, 61, 68, 62, 205, 203, 0, 0, 0,
1504 0, 0, 0, 80, 69, 70, 201, 84, 87, 0,
1505 0, 217, 0, 0, 65, 0, 71, 72, 74, 73,
1506 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1507 196, 202, 85, 86, 80, 206, 88, 89, 90, 91,
1508 80, 264, 204, 264, 0, 0, 225, 218, 219, 207,
1509 253, 254, 209, 130, 131, 132, 135, 134, 133, 136,
1510 137, 0, 0, 0, 0, 255, 256, 138, 208, 140,
1511 196, 196, 92, 195, 0, 95, 95, 265, 261, 66,
1512 236, 237, 238, 260, 220, 221, 224, 0, 158, 141,
1513 0, 0, 0, 0, 147, 159, 0, 139, 158, 0,
1514 0, 94, 93, 0, 193, 194, 0, 0, 96, 97,
1515 98, 99, 100, 0, 239, 0, 303, 263, 0, 222,
1516 157, 111, 153, 155, 0, 0, 0, 0, 0, 0,
1517 146, 0, 0, 0, 152, 0, 151, 0, 216, 130,
1518 131, 132, 135, 134, 133, 0, 0, 0, 210, 101,
1519 0, 233, 234, 235, 302, 288, 0, 0, 0, 0,
1520 95, 273, 274, 1, 2, 3, 4, 5, 6, 7,
1521 8, 9, 13, 14, 15, 10, 11, 12, 0, 0,
1522 0, 0, 0, 0, 16, 17, 18, 19, 20, 21,
1523 22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
1524 0, 0, 0, 0, 0, 262, 95, 277, 0, 301,
1525 223, 150, 0, 117, 0, 0, 149, 0, 160, 117,
1526 212, 214, 0, 197, 178, 179, 174, 176, 175, 177,
1527 180, 173, 169, 170, 0, 0, 0, 0, 0, 0,
1528 0, 0, 0, 0, 0, 0, 0, 0, 172, 171,
1529 126, 0, 287, 267, 0, 266, 0, 0, 54, 0,
1530 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1531 37, 0, 52, 53, 48, 49, 50, 51, 38, 39,
1532 40, 41, 42, 43, 44, 45, 46, 47, 0, 121,
1533 121, 308, 0, 0, 299, 0, 0, 0, 0, 0,
1534 0, 0, 0, 0, 0, 0, 103, 105, 104, 102,
1535 106, 107, 108, 109, 110, 112, 156, 154, 143, 144,
1536 145, 148, 142, 126, 126, 0, 0, 0, 0, 0,
1537 0, 0, 0, 162, 192, 0, 0, 0, 166, 0,
1538 163, 0, 0, 0, 0, 211, 231, 242, 243, 244,
1539 249, 245, 246, 247, 248, 240, 0, 251, 258, 257,
1540 259, 0, 268, 0, 0, 0, 0, 0, 304, 0,
1541 306, 285, 0, 0, 0, 0, 0, 0, 0, 0,
1542 0, 0, 0, 0, 0, 116, 115, 113, 114, 118,
1543 213, 215, 0, 0, 0, 285, 0, 0, 0, 0,
1544 0, 161, 147, 159, 0, 164, 165, 0, 0, 0,
1545 0, 0, 128, 126, 230, 111, 228, 0, 241, 0,
1546 0, 0, 0, 0, 0, 0, 0, 0, 0, 311,
1547 0, 0, 0, 295, 296, 0, 0, 0, 0, 293,
1548 0, 121, 0, 0, 0, 0, 0, 0, 0, 0,
1549 0, 191, 168, 0, 0, 0, 0, 123, 129, 127,
1550 64, 0, 117, 0, 250, 0, 0, 284, 0, 0,
1551 121, 122, 121, 0, 0, 0, 0, 0, 0, 289,
1552 290, 284, 0, 309, 0, 198, 0, 0, 182, 0,
1553 0, 0, 0, 167, 0, 0, 0, 63, 227, 229,
1554 111, 124, 0, 0, 0, 136, 0, 0, 291, 292,
1555 305, 307, 286, 0, 0, 294, 297, 298, 0, 121,
1556 0, 0, 0, 188, 0, 0, 184, 185, 181, 64,
1557 125, 119, 252, 0, 0, 111, 111, 0, 117, 278,
1558 0, 117, 310, 186, 187, 0, 0, 0, 226, 0,
1559 232, 0, 271, 0, 0, 281, 280, 136, 0, 0,
1560 279, 300, 183, 189, 190, 120, 269, 0, 270, 0,
1561 111, 111, 0, 0, 0, 283, 282, 0, 0, 0,
1562 0, 276, 0, 0, 275, 0, 272, 0, 0, 0
1565 static const short yydefgoto[] = { 256,
1566 257, 258, 282, 299, 156, 157, 76, 509, 12, 77,
1567 14, 15, 39, 40, 41, 45, 51, 114, 124, 326,
1568 222, 400, 329, 561, 379, 423, 542, 356, 424, 78,
1569 158, 133, 148, 134, 135, 107, 345, 368, 346, 117,
1570 85, 149, 598, 16, 17, 19, 18, 261, 334, 335,
1571 60, 22, 58, 98, 427, 428, 125, 164, 52, 93,
1572 53, 46, 430, 369, 80, 371, 266, 54, 89, 90,
1573 216, 565, 128, 305, 518, 440, 217, 218, 219, 220
1576 static const short yypact[] = { 42,
1577 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -8, -110, 13,
1578 -39, 104, 5, 167,-32768, 321,-32768, 83, 74, 12,
1579 17,-32768, 41, 148,-32768, 1305,-32768,-32768,-32768,-32768,
1580 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 117, 117,
1581 11,-32768,-32768,-32768, 117,-32768,-32768,-32768,-32768,-32768,
1582 117, 154,-32768, -10, 181, 204, 212,-32768,-32768,-32768,
1583 -32768,-32768, 98,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1584 -32768, 254, 259, 3, 958,-32768,-32768,-32768, 49,-32768,
1585 231, 231, 225,-32768, 65, 215, 215,-32768,-32768, 131,
1586 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -34, 1038,-32768,
1587 120, 128, 976, 98,-32768, 49, -123,-32768, 1038, 65,
1588 65,-32768,-32768, 1056,-32768,-32768, 1327, 280,-32768,-32768,
1589 -32768,-32768,-32768, 1345,-32768, -16, 1663,-32768, 263,-32768,
1590 -32768, 49,-32768, 139, 136, 1398, 1398, 132, -95, 1398,
1591 -32768, 143, 1327, 1398, 98, 145, 49, 213,-32768, 50,
1592 287, 289, 298, 299, 300, 219, 304, 805,-32768,-32768,
1593 233,-32768,-32768,-32768,-32768,-32768, 260, 1496, 70, 303,
1594 215,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1595 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 396, 449,
1596 1398, 1398, 1398, 1398,-32768,-32768,-32768,-32768,-32768,-32768,
1597 -32768,-32768,-32768,-32768,-32768,-32768, 1398, 1398, 1398, 1398,
1598 1398, 1398, 1398, 1398, 1398,-32768, 215,-32768, 125,-32768,
1599 -32768, -32, 1078,-32768, 23, -105,-32768, 160, 49,-32768,
1600 -32768, 49, 1056,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1601 -32768,-32768,-32768,-32768, 396, 449, 168, 169, 170, 173,
1602 174, 1229, 1514, 998, 295, 175, 179, 183,-32768,-32768,
1603 187, 185,-32768, 98, 646,-32768, 780, 780,-32768, 780,
1604 1345,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1605 -32768, 1398,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1606 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1398, 97,
1607 102,-32768, 646, 24, 195, 203, 208, 209, 210, 211,
1608 646, 646, 332, 1345, 1398, 1398,-32768,-32768,-32768,-32768,
1609 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 10,-32768,
1610 -32768,-32768, 10, 187, 187, 333, 186, 223, 1327, 1327,
1611 1327, 1327, 1327,-32768,-32768, -15, 1016, -55,-32768, -79,
1612 -32768, 1327, 1327, 1327, -4,-32768, 1247,-32768,-32768,-32768,
1613 -32768,-32768,-32768,-32768,-32768, 317, 1327,-32768,-32768,-32768,
1614 -32768, 234,-32768, 235, 780, 646, 646, 4,-32768, 22,
1615 -32768,-32768, 780, 207, 1398, 1398, 1398, 1398, 1398, 236,
1616 240, 1398, 780, 646, 241,-32768,-32768,-32768,-32768,-32768,
1617 -32768,-32768, 1398, 1327, 1327,-32768, 244, 246, 247, 251,
1618 1327,-32768, 224, 805, -78,-32768,-32768, 252, 253, 363,
1619 380, 399,-32768, 187,-32768, 49, 257, 256,-32768, 386,
1620 -52, 392, 393, 261, 270, 275, 780, 422, 780, 282,
1621 283, 780, 284, 49,-32768, 285, 288, 780, 780, 49,
1622 277, 290, 1398, 30, 291, 292, -80, 1327, 1327, 1327,
1623 1327,-32768,-32768, 293, 1327, 1327, 1398,-32768,-32768,-32768,
1624 278, 1287,-32768, 294,-32768, 780, 780, 1554, 780, 780,
1625 290,-32768, 290, 1398, 780, 296, 1398, 1398, 1398,-32768,
1626 -32768, 1554, 383,-32768, 646,-32768, 1327, 1327,-32768, 297,
1627 301, 307, 308,-32768, 305, 309, 68,-32768,-32768,-32768,
1628 49, -11, 418, 314, 313, 780, 646, -9,-32768,-32768,
1629 -32768,-32768,-32768, 312, 780,-32768,-32768,-32768, 44, 290,
1630 318, 319, 1327,-32768, 1327, 1327,-32768,-32768,-32768, 278,
1631 -32768, 395,-32768, 428, -7,-32768,-32768, 1572,-32768,-32768,
1632 320,-32768,-32768,-32768,-32768, 322, 328, 329,-32768, 442,
1633 -32768, 780,-32768, 503, -2, -32, -32, 780, 646, 1,
1634 -32768, 10,-32768,-32768,-32768,-32768,-32768, 325,-32768, 503,
1635 -32768,-32768, 433, 451, 334, -32, -32, 780, 780, 466,
1636 413,-32768, 780, 479,-32768, 780,-32768, 500, 501,-32768
1639 static const short yypgoto[] = { 375,
1640 376, 377, 264, 262, -168,-32768, 0, -30, 421, 18,
1641 -32768,-32768,-32768,-32768, 43,-32768,-32768,-32768, -158,-32768,
1642 -420,-32768, -222,-32768, -287, 2,-32768, -294,-32768,-32768,
1643 -25, 302, -107,-32768, 404, 414, -112, -155, -233, 144,
1644 189, 286,-32768,-32768, 502,-32768,-32768,-32768,-32768,-32768,
1645 -32768,-32768,-32768,-32768,-32768,-32768, 434,-32768,-32768,-32768,
1646 -32768,-32768,-32768, -542, -111, 122, -183,-32768, 468,-32768,
1647 -32768,-32768,-32768,-32768, 28, 118,-32768,-32768,-32768,-32768
1654 static const short yytable[] = { 11,
1655 79, 270, 259, 269, 159, 471, 102, 333, 269, 302,
1656 88, 162, 271, 381, 437, 11, 161, 13, 91, 348,
1657 350, 578, 421, 140, 306, 307, 308, 309, 310, 421,
1658 231, 313, 439, 13, 141, 23, 234, 585, 583, 401,
1659 402, -200, 108, 20, 109, 83, 260, 84, 422, 106,
1660 331, 140, -54, -54, -54, -54, 438, 21, 314, -66,
1661 1, 2, 228, 3, 4, 5, 484, 411, 411, 24,
1662 499, 6, 7, 132, 438, 235, 236, 106, 417, 464,
1663 267, 81, 82, 132, 317, 318, 268, 86, 147, 11,
1664 540, 411, 8, 87, 411, 9, 115, 116, 147, 10,
1665 416, 319, 320, 475, 321, 322, 25, 323, 324, 325,
1666 225, 226, 129, 415, 229, 47, 48, 49, 232, 130,
1667 50, 26, 396, 397, 398, 566, 567, 399, 43, 470,
1668 44, 411, 395, 431, 396, 397, 398, 548, 412, 399,
1669 163, 549, 265, 396, 397, 398, 563, 92, 399, 1,
1670 27, 579, 3, 370, 5, 370, 370, 55, 370, 103,
1671 586, 587, 56, 375, 494, 300, 301, 265, 303, 59,
1672 108, 108, 109, 109, 88, 383, 330, 108, 262, 109,
1673 496, 304, 265, 265, 265, 265, 265, 311, 312, 265,
1674 548, 370, 57, 521, 552, 522, 108, 132, 109, 370,
1675 370, 443, 95, 445, 446, 447, 393, 147, 28, 29,
1676 30, 31, 32, 33, 34, 108, 35, 109, 539, 61,
1677 62, 237, 238, 239, 240, 96, 406, 407, 408, 409,
1678 410, 1, 2, 97, 3, 4, 5, 315, 316, 418,
1679 419, 420, 553, 378, 108, 147, 109, 99, 380, 108,
1680 512, 109, 2, 143, 144, 4, 376, 100, 259, 36,
1681 37, 38, 101, 370, 370, 370, 112, 84, 113, 110,
1682 111, 370, 136, 377, 118, 119, 120, 121, 122, 123,
1683 137, 370, 370, 160, 221, 223, 224, 227, 147, 394,
1684 265, 455, 456, 230, 233, -55, 1, -56, 462, 3,
1685 523, 5, 260, 526, 527, 528, -59, -58, -57, 36,
1686 37, 38, 241, 269, 263, 332, 351, 339, 340, 341,
1687 -199, 414, 342, 343, 352, 370, 570, 370, 353, 572,
1688 370, 426, 354, 355, 357, 404, 370, 370, -66, 1,
1689 2, 384, 3, 4, 5, 500, 501, 502, 503, 385,
1690 6, 7, 505, 506, 386, 387, 388, 389, 442, 265,
1691 444, 265, 265, 265, 370, 370, 450, 370, 370, 392,
1692 403, 8, 405, 370, 9, 429, 564, 454, 10, 463,
1693 432, 433, 448, 370, 531, 532, 449, 453, 372, 373,
1694 458, 374, 459, 460, 317, 318, 580, 461, 465, 466,
1695 467, 468, 469, 472, 370, 370, 473, 474, 476, 477,
1696 478, 319, 320, 370, 321, 322, 479, 323, 324, 325,
1697 556, 480, 557, 558, 382, 482, 492, 495, 484, 485,
1698 487, 488, 390, 391, 489, 438, 493, 497, 498, 543,
1699 513, 507, 525, 533, 562, 576, 511, 560, 504, 588,
1700 370, 534, 517, 535, 536, 537, 370, 370, 265, 538,
1701 544, 265, 265, 265, 545, 550, 517, 589, 554, 555,
1702 508, 584, 573, 571, 283, 284, 370, 370, 574, 575,
1703 590, 370, 593, 594, 370, 272, 273, 274, 275, 276,
1704 277, 278, 279, 280, 281, 596, 434, 435, 436, 599,
1705 600, 213, 214, 215, 441, 358, 359, 338, 337, 559,
1706 127, 360, 142, 541, 451, 452, 139, 42, 336, 529,
1707 126, 94, 569, 457, 328, 0, 0, 361, 362, 363,
1708 0, 0, 0, 0, 0, 0, 0, 0, 0, 508,
1709 0, 0, 364, 365, 285, 286, 287, 288, 289, 290,
1710 291, 292, 293, 294, 295, 296, 297, 298, 481, 366,
1711 483, 0, 0, 486, 0, 0, 0, 0, 0, 490,
1712 491, 0, 0, 0, 0, 174, 175, 176, 177, 178,
1713 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
1714 245, 246, 0, 0, 0, 0, 0, 514, 515, 0,
1715 519, 520, 0, 0, 0, 0, 524, 0, 0, 0,
1716 0, 0, 0, 0, 0, 0, 530, 247, 195, 196,
1717 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
1718 0, 248, 0, 249, 250, 251, 0, 546, 547, 0,
1719 0, 0, 0, 0, 0, 0, 551, 0, 358, 359,
1720 0, 0, 61, 62, 360, 0, 0, 367, 0, 0,
1721 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
1722 361, 362, 363, 0, 0, 0, 0, 0, 0, 0,
1723 0, 0, 0, 577, 0, 364, 365, 0, 0, 581,
1724 582, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1725 0, 0, 366, 0, 0, 0, 0, 0, 0, 591,
1726 592, 0, 0, 0, 595, 0, 0, 597, 174, 175,
1727 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
1728 186, 187, 188, 245, 246, 0, 0, 0, 0, 0,
1729 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1730 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1731 247, 195, 196, 197, 198, 199, 200, 201, 202, 203,
1732 204, 205, 206, 0, 248, 0, 249, 250, 251, 0,
1733 0, 0, 358, 359, 0, 0, 61, 62, 360, 0,
1734 0, 0, 0, 108, 0, 109, 0, 0, 1, 2,
1735 367, 3, 4, 5, 361, 362, 363, 0, 0, 0,
1736 0, 61, 62, 0, 0, 0, 0, 0, 0, 364,
1737 365, 0, 0, 1, 2, 0, 3, 4, 5, 242,
1738 0, 0, 0, 0, 0, 0, 366, 0, 0, 0,
1739 0, 0, 0, 0, 243, 244, 0, 0, 0, 0,
1740 0, 0, 174, 175, 176, 177, 178, 179, 180, 181,
1741 182, 183, 184, 185, 186, 187, 188, 245, 246, 0,
1742 0, 0, 0, 0, 0, 0, 0, 174, 175, 176,
1743 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1744 187, 188, 245, 246, 247, 195, 196, 197, 198, 199,
1745 200, 201, 202, 203, 204, 205, 206, 0, 248, 0,
1746 249, 250, 251, 0, 0, 0, 0, 0, 0, 247,
1747 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1748 205, 206, 0, 248, 367, 249, 250, 251, 0, 0,
1749 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1750 0, 0, 108, 0, 109, 0, 252, 0, 0, 253,
1751 0, 254, 0, 255, 61, 62, 0, 104, 64, 65,
1752 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1753 4, 5, 61, 62, 0, 104, 64, 65, 66, 67,
1754 68, 69, 70, 0, 1, 2, 0, 3, 4, 5,
1755 0, 0, 0, 0, 61, 62, 71, 104, 150, 151,
1756 152, 153, 154, 155, 70, 0, 1, 2, 0, 3,
1757 4, 5, 61, 62, 71, 104, 150, 151, 152, 153,
1758 154, 155, 70, 0, 1, 2, 0, 3, 4, 5,
1759 0, 0, 0, 0, 61, 62, 71, 104, 64, 65,
1760 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1761 4, 5, 61, 62, 71, 145, 64, 65, 66, 67,
1762 68, 69, 70, 0, 1, 2, 131, 3, 4, 5,
1763 0, 0, 0, 0, 61, 62, 71, 104, 64, 65,
1764 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1765 4, 5, 0, 0, 71, 0, 72, 0, 0, 73,
1766 0, 0, 74, 0, 75, 105, 327, 0, 0, 0,
1767 0, 0, 0, 0, 72, 0, 71, 73, 0, 0,
1768 74, 0, 75, 138, 0, 0, 0, 0, 0, 0,
1769 0, 0, 0, 0, 0, 0, 72, 0, 0, 73,
1770 0, 0, 74, 0, 75, 349, 0, 0, 0, 0,
1771 0, 0, 0, 0, 72, 0, 0, 73, 0, 0,
1772 74, 0, 75, 413, 0, 0, 146, 0, 0, 0,
1773 0, 0, 0, 0, 0, 0, 72, 0, 0, 73,
1774 0, 0, 74, 0, 75, 0, 0, 0, 0, 0,
1775 0, 0, 0, 0, 72, 0, 0, 73, 0, 0,
1776 74, 0, 75, 0, 0, 0, 0, 0, 0, 0,
1777 0, 0, 0, 0, 0, 0, 72, 0, 0, 73,
1778 0, 0, 74, 0, 75, 61, 62, 0, 104, 150,
1779 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1780 3, 4, 5, 61, 62, 0, 104, 64, 65, 66,
1781 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1782 5, 0, 0, 0, 0, 0, 0, 71, 0, 0,
1783 0, 0, 0, 0, 0, 425, 0, 0, 0, 0,
1784 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1785 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1786 5, 61, 62, 0, 63, 64, 65, 66, 67, 68,
1787 69, 70, 0, 1, 2, 510, 3, 4, 5, 0,
1788 0, 0, 0, 61, 62, 71, 104, 150, 151, 152,
1789 153, 154, 155, 70, 0, 1, 2, 0, 3, 4,
1790 5, 61, 62, 71, 145, 64, 65, 66, 67, 68,
1791 69, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1792 0, 0, 0, 0, 0, 71, 0, 72, 0, 0,
1793 73, 0, 344, 74, 0, 75, 0, 0, 0, 0,
1794 0, 0, 0, 71, 0, 72, 0, 0, 73, 0,
1795 0, 74, 0, 75, 61, 62, 0, 104, 64, 65,
1796 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1797 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
1798 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1799 0, 74, 0, 75, 0, 0, 71, 0, 0, 0,
1800 0, 0, 0, 72, 0, 0, 73, 0, 0, 74,
1801 0, 75, 0, 0, 0, 0, 0, 0, 0, 0,
1802 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1803 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
1804 0, 0, 0, 72, 0, 0, 73, 0, 0, 74,
1805 0, 75, 61, 62, 0, 264, 64, 65, 66, 67,
1806 68, 69, 70, 0, 1, 2, 0, 3, 4, 5,
1807 61, 62, 0, 104, 150, 151, 152, 153, 154, 155,
1808 70, 0, 1, 2, 0, 3, 4, 5, 0, 0,
1809 0, 0, 0, 0, 71, 0, 72, 0, 0, 73,
1810 0, 0, 74, 0, 75, 0, 0, 0, 0, 0,
1811 61, 62, 71, 104, 64, 65, 66, 67, 68, 69,
1812 516, 0, 1, 2, 0, 3, 4, 5, 61, 62,
1813 0, 104, 64, 65, 66, 67, 68, 69, 568, 0,
1814 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
1815 0, 0, 71, 0, 0, 0, 0, 0, 0, 0,
1816 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1817 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1818 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1819 0, 0, 0, 0, 72, 0, 0, 73, 0, 0,
1820 74, 0, 75, 0, 0, 0, 0, 0, 0, 0,
1821 0, 0, 72, 0, 0, 73, 0, 0, 74, 0,
1822 347, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1823 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1824 0, 0, 0, 0, 0, 0, 0, 0, 165, 0,
1825 0, 0, 72, 0, 0, 73, 0, 0, 74, 0,
1826 75, 0, 0, 0, 0, 0, 0, 166, 167, 0,
1827 72, 0, 0, 73, 0, 0, 74, 0, 75, 168,
1828 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
1829 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
1830 189, 190, 0, 0, 0, 0, 0, 0, 0, 0,
1831 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1832 0, 0, 191, 192, 193, 0, 0, 194, 195, 196,
1833 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
1834 207, 208, 209, 210, 211, 212
1837 static const short yycheck[] = { 0,
1838 26, 170, 158, 11, 117, 426, 4, 230, 11, 193,
1839 21, 28, 171, 301, 11, 16, 124, 0, 29, 253,
1840 254, 564, 34, 147, 208, 209, 210, 211, 212, 34,
1841 143, 215, 11, 16, 158, 146, 148, 580, 38, 334,
1842 335, 0, 148, 52, 150, 35, 158, 37, 53, 75,
1843 156, 147, 3, 4, 5, 6, 53, 66, 217, 18,
1844 19, 20, 158, 22, 23, 24, 147, 147, 147, 57,
1845 151, 30, 31, 99, 53, 26, 27, 103, 158, 158,
1846 11, 39, 40, 109, 117, 118, 17, 45, 114, 90,
1847 511, 147, 51, 51, 147, 54, 32, 33, 124, 58,
1848 156, 134, 135, 156, 137, 138, 146, 140, 141, 142,
1849 136, 137, 147, 347, 140, 42, 43, 44, 144, 154,
1850 47, 18, 134, 135, 136, 546, 547, 139, 46, 424,
1851 48, 147, 316, 367, 134, 135, 136, 147, 154, 139,
1852 157, 151, 168, 134, 135, 136, 154, 158, 139, 19,
1853 146, 154, 22, 265, 24, 267, 268, 146, 270, 157,
1854 581, 582, 146, 271, 452, 191, 192, 193, 194, 22,
1855 148, 148, 150, 150, 21, 152, 154, 148, 161, 150,
1856 151, 207, 208, 209, 210, 211, 212, 213, 214, 215,
1857 147, 303, 152, 481, 151, 483, 148, 223, 150, 311,
1858 312, 385, 22, 387, 388, 389, 314, 233, 42, 43,
1859 44, 45, 46, 47, 48, 148, 50, 150, 151, 7,
1860 8, 3, 4, 5, 6, 22, 339, 340, 341, 342,
1861 343, 19, 20, 22, 22, 23, 24, 113, 114, 352,
1862 353, 354, 530, 147, 148, 271, 150, 150, 147, 148,
1863 473, 150, 20, 110, 111, 23, 282, 4, 414, 143,
1864 144, 145, 4, 375, 376, 377, 42, 37, 44, 81,
1865 82, 383, 153, 299, 60, 61, 62, 63, 64, 65,
1866 153, 393, 394, 4, 22, 147, 151, 156, 314, 315,
1867 316, 404, 405, 151, 150, 9, 19, 9, 411, 22,
1868 484, 24, 414, 487, 488, 489, 9, 9, 9, 143,
1869 144, 145, 9, 11, 55, 156, 22, 150, 150, 150,
1870 0, 347, 150, 150, 150, 437, 549, 439, 150, 552,
1871 442, 357, 150, 147, 150, 150, 448, 449, 18, 19,
1872 20, 147, 22, 23, 24, 458, 459, 460, 461, 147,
1873 30, 31, 465, 466, 147, 147, 147, 147, 152, 385,
1874 386, 387, 388, 389, 476, 477, 392, 479, 480, 38,
1875 38, 51, 150, 485, 54, 59, 545, 403, 58, 156,
1876 147, 147, 147, 495, 497, 498, 147, 147, 267, 268,
1877 147, 270, 147, 147, 117, 118, 565, 147, 147, 147,
1878 38, 22, 4, 147, 516, 517, 151, 22, 17, 17,
1879 150, 134, 135, 525, 137, 138, 147, 140, 141, 142,
1880 533, 147, 535, 536, 303, 4, 150, 453, 147, 147,
1881 147, 147, 311, 312, 147, 53, 147, 147, 147, 22,
1882 147, 467, 147, 147, 17, 4, 472, 53, 156, 17,
1883 562, 151, 478, 147, 147, 151, 568, 569, 484, 151,
1884 147, 487, 488, 489, 152, 154, 492, 17, 151, 151,
1885 471, 147, 151, 154, 26, 27, 588, 589, 151, 151,
1886 147, 593, 17, 71, 596, 90, 91, 92, 93, 94,
1887 95, 96, 97, 98, 99, 17, 375, 376, 377, 0,
1888 0, 127, 127, 127, 383, 3, 4, 246, 245, 540,
1889 90, 9, 109, 512, 393, 394, 103, 16, 233, 492,
1890 87, 54, 548, 406, 223, -1, -1, 25, 26, 27,
1891 -1, -1, -1, -1, -1, -1, -1, -1, -1, 540,
1892 -1, -1, 40, 41, 96, 97, 98, 99, 100, 101,
1893 102, 103, 104, 105, 106, 107, 108, 109, 437, 57,
1894 439, -1, -1, 442, -1, -1, -1, -1, -1, 448,
1895 449, -1, -1, -1, -1, 73, 74, 75, 76, 77,
1896 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1897 88, 89, -1, -1, -1, -1, -1, 476, 477, -1,
1898 479, 480, -1, -1, -1, -1, 485, -1, -1, -1,
1899 -1, -1, -1, -1, -1, -1, 495, 115, 116, 117,
1900 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1901 -1, 129, -1, 131, 132, 133, -1, 516, 517, -1,
1902 -1, -1, -1, -1, -1, -1, 525, -1, 3, 4,
1903 -1, -1, 7, 8, 9, -1, -1, 155, -1, -1,
1904 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
1905 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
1906 -1, -1, -1, 562, -1, 40, 41, -1, -1, 568,
1907 569, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1908 -1, -1, 57, -1, -1, -1, -1, -1, -1, 588,
1909 589, -1, -1, -1, 593, -1, -1, 596, 73, 74,
1910 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1911 85, 86, 87, 88, 89, -1, -1, -1, -1, -1,
1912 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1913 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1914 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1915 125, 126, 127, -1, 129, -1, 131, 132, 133, -1,
1916 -1, -1, 3, 4, -1, -1, 7, 8, 9, -1,
1917 -1, -1, -1, 148, -1, 150, -1, -1, 19, 20,
1918 155, 22, 23, 24, 25, 26, 27, -1, -1, -1,
1919 -1, 7, 8, -1, -1, -1, -1, -1, -1, 40,
1920 41, -1, -1, 19, 20, -1, 22, 23, 24, 25,
1921 -1, -1, -1, -1, -1, -1, 57, -1, -1, -1,
1922 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
1923 -1, -1, 73, 74, 75, 76, 77, 78, 79, 80,
1924 81, 82, 83, 84, 85, 86, 87, 88, 89, -1,
1925 -1, -1, -1, -1, -1, -1, -1, 73, 74, 75,
1926 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1927 86, 87, 88, 89, 115, 116, 117, 118, 119, 120,
1928 121, 122, 123, 124, 125, 126, 127, -1, 129, -1,
1929 131, 132, 133, -1, -1, -1, -1, -1, -1, 115,
1930 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1931 126, 127, -1, 129, 155, 131, 132, 133, -1, -1,
1932 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1933 -1, -1, 148, -1, 150, -1, 152, -1, -1, 155,
1934 -1, 157, -1, 159, 7, 8, -1, 10, 11, 12,
1935 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1936 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
1937 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
1938 -1, -1, -1, -1, 7, 8, 49, 10, 11, 12,
1939 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1940 23, 24, 7, 8, 49, 10, 11, 12, 13, 14,
1941 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
1942 -1, -1, -1, -1, 7, 8, 49, 10, 11, 12,
1943 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1944 23, 24, 7, 8, 49, 10, 11, 12, 13, 14,
1945 15, 16, 17, -1, 19, 20, 39, 22, 23, 24,
1946 -1, -1, -1, -1, 7, 8, 49, 10, 11, 12,
1947 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1948 23, 24, -1, -1, 49, -1, 149, -1, -1, 152,
1949 -1, -1, 155, -1, 157, 158, 39, -1, -1, -1,
1950 -1, -1, -1, -1, 149, -1, 49, 152, -1, -1,
1951 155, -1, 157, 158, -1, -1, -1, -1, -1, -1,
1952 -1, -1, -1, -1, -1, -1, 149, -1, -1, 152,
1953 -1, -1, 155, -1, 157, 158, -1, -1, -1, -1,
1954 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
1955 155, -1, 157, 158, -1, -1, 121, -1, -1, -1,
1956 -1, -1, -1, -1, -1, -1, 149, -1, -1, 152,
1957 -1, -1, 155, -1, 157, -1, -1, -1, -1, -1,
1958 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
1959 155, -1, 157, -1, -1, -1, -1, -1, -1, -1,
1960 -1, -1, -1, -1, -1, -1, 149, -1, -1, 152,
1961 -1, -1, 155, -1, 157, 7, 8, -1, 10, 11,
1962 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1963 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
1964 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1965 24, -1, -1, -1, -1, -1, -1, 49, -1, -1,
1966 -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
1967 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1968 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1969 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
1970 16, 17, -1, 19, 20, 39, 22, 23, 24, -1,
1971 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1972 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1973 24, 7, 8, 49, 10, 11, 12, 13, 14, 15,
1974 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1975 -1, -1, -1, -1, -1, 49, -1, 149, -1, -1,
1976 152, -1, 154, 155, -1, 157, -1, -1, -1, -1,
1977 -1, -1, -1, 49, -1, 149, -1, -1, 152, -1,
1978 -1, 155, -1, 157, 7, 8, -1, 10, 11, 12,
1979 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1980 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
1981 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1982 -1, 155, -1, 157, -1, -1, 49, -1, -1, -1,
1983 -1, -1, -1, 149, -1, -1, 152, -1, -1, 155,
1984 -1, 157, -1, -1, -1, -1, -1, -1, -1, -1,
1985 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1986 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
1987 -1, -1, -1, 149, -1, -1, 152, -1, -1, 155,
1988 -1, 157, 7, 8, -1, 10, 11, 12, 13, 14,
1989 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
1990 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
1991 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
1992 -1, -1, -1, -1, 49, -1, 149, -1, -1, 152,
1993 -1, -1, 155, -1, 157, -1, -1, -1, -1, -1,
1994 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
1995 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
1996 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
1997 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
1998 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
1999 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2000 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2001 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2002 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
2003 155, -1, 157, -1, -1, -1, -1, -1, -1, -1,
2004 -1, -1, 149, -1, -1, 152, -1, -1, 155, -1,
2005 157, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2006 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2007 -1, -1, -1, -1, -1, -1, -1, -1, 36, -1,
2008 -1, -1, 149, -1, -1, 152, -1, -1, 155, -1,
2009 157, -1, -1, -1, -1, -1, -1, 55, 56, -1,
2010 149, -1, -1, 152, -1, -1, 155, -1, 157, 67,
2011 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2012 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2013 88, 89, -1, -1, -1, -1, -1, -1, -1, -1,
2014 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2015 -1, -1, 110, 111, 112, -1, -1, 115, 116, 117,
2016 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2017 128, 129, 130, 131, 132, 133
2019 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2020 #line 3 "/usr/share/bison.simple"
2021 /* This file comes from bison-1.28. */
2023 /* Skeleton output parser for bison,
2024 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2026 This program is free software; you can redistribute it and/or modify
2027 it under the terms of the GNU General Public License as published by
2028 the Free Software Foundation; either version 2, or (at your option)
2031 This program is distributed in the hope that it will be useful,
2032 but WITHOUT ANY WARRANTY; without even the implied warranty of
2033 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2034 GNU General Public License for more details.
2036 You should have received a copy of the GNU General Public License
2037 along with this program; if not, write to the Free Software
2038 Foundation, Inc., 59 Temple Place - Suite 330,
2039 Boston, MA 02111-1307, USA. */
2041 /* As a special exception, when this file is copied by Bison into a
2042 Bison output file, you may use that output file without restriction.
2043 This special exception was added by the Free Software Foundation
2044 in version 1.24 of Bison. */
2046 /* This is the parser code that is written into each bison parser
2047 when the %semantic_parser declaration is not specified in the grammar.
2048 It was written by Richard Stallman by simplifying the hairy parser
2049 used when %semantic_parser is specified. */
2051 #ifndef YYSTACK_USE_ALLOCA
2053 #define YYSTACK_USE_ALLOCA
2054 #else /* alloca not defined */
2056 #define YYSTACK_USE_ALLOCA
2057 #define alloca __builtin_alloca
2058 #else /* not GNU C. */
2059 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2060 #define YYSTACK_USE_ALLOCA
2062 #else /* not sparc */
2063 /* We think this test detects Watcom and Microsoft C. */
2064 /* This used to test MSDOS, but that is a bad idea
2065 since that symbol is in the user namespace. */
2066 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2067 #if 0 /* No need for malloc.h, which pollutes the namespace;
2068 instead, just don't use alloca. */
2071 #else /* not MSDOS, or __TURBOC__ */
2073 /* I don't know what this was needed for, but it pollutes the namespace.
2074 So I turned it off. rms, 2 May 1997. */
2075 /* #include <malloc.h> */
2077 #define YYSTACK_USE_ALLOCA
2078 #else /* not MSDOS, or __TURBOC__, or _AIX */
2080 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2081 and on HPUX 10. Eventually we can turn this on. */
2082 #define YYSTACK_USE_ALLOCA
2083 #define alloca __builtin_alloca
2086 #endif /* not _AIX */
2087 #endif /* not MSDOS, or __TURBOC__ */
2088 #endif /* not sparc */
2089 #endif /* not GNU C */
2090 #endif /* alloca not defined */
2091 #endif /* YYSTACK_USE_ALLOCA not defined */
2093 #ifdef YYSTACK_USE_ALLOCA
2094 #define YYSTACK_ALLOC alloca
2096 #define YYSTACK_ALLOC malloc
2099 /* Note: there must be only one dollar sign in this file.
2100 It is replaced by the list of actions, each action
2101 as one case of the switch. */
2103 #define yyerrok (yyerrstatus = 0)
2104 #define yyclearin (yychar = YYEMPTY)
2107 #define YYACCEPT goto yyacceptlab
2108 #define YYABORT goto yyabortlab
2109 #define YYERROR goto yyerrlab1
2110 /* Like YYERROR except do call yyerror.
2111 This remains here temporarily to ease the
2112 transition to the new meaning of YYERROR, for GCC.
2113 Once GCC version 2 has supplanted version 1, this can go. */
2114 #define YYFAIL goto yyerrlab
2115 #define YYRECOVERING() (!!yyerrstatus)
2116 #define YYBACKUP(token, value) \
2118 if (yychar == YYEMPTY && yylen == 1) \
2119 { yychar = (token), yylval = (value); \
2120 yychar1 = YYTRANSLATE (yychar); \
2125 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2129 #define YYERRCODE 256
2132 #define YYLEX yylex()
2138 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2140 #define YYLEX yylex(&yylval, &yylloc)
2142 #else /* not YYLSP_NEEDED */
2144 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2146 #define YYLEX yylex(&yylval)
2148 #endif /* not YYLSP_NEEDED */
2151 /* If nonreentrant, generate the variables here */
2155 int yychar; /* the lookahead symbol */
2156 YYSTYPE yylval; /* the semantic value of the */
2157 /* lookahead symbol */
2160 YYLTYPE yylloc; /* location data for the lookahead */
2164 int yynerrs; /* number of parse errors so far */
2165 #endif /* not YYPURE */
2168 int yydebug; /* nonzero means print parse trace */
2169 /* Since this is uninitialized, it does not stop multiple parsers
2173 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2176 #define YYINITDEPTH 200
2179 /* YYMAXDEPTH is the maximum size the stacks can grow to
2180 (effective only if the built-in stack extension method is used). */
2187 #define YYMAXDEPTH 10000
2190 /* Define __yy_memcpy. Note that the size argument
2191 should be passed with type unsigned int, because that is what the non-GCC
2192 definitions require. With GCC, __builtin_memcpy takes an arg
2193 of type size_t, but it can handle unsigned int. */
2195 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2196 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2197 #else /* not GNU C or C++ */
2200 /* This is the most reliable way to avoid incompatibilities
2201 in available built-in functions on various systems. */
2203 __yy_memcpy (to, from, count)
2208 register char *f = from;
2209 register char *t = to;
2210 register int i = count;
2216 #else /* __cplusplus */
2218 /* This is the most reliable way to avoid incompatibilities
2219 in available built-in functions on various systems. */
2221 __yy_memcpy (char *to, char *from, unsigned int count)
2223 register char *t = to;
2224 register char *f = from;
2225 register int i = count;
2234 #line 217 "/usr/share/bison.simple"
2236 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2237 into yyparse. The argument should have type void *.
2238 It should actually point to an object.
2239 Grammar actions can access the variable by casting it
2240 to the proper pointer type. */
2242 #ifdef YYPARSE_PARAM
2244 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2245 #define YYPARSE_PARAM_DECL
2246 #else /* not __cplusplus */
2247 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2248 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2249 #endif /* not __cplusplus */
2250 #else /* not YYPARSE_PARAM */
2251 #define YYPARSE_PARAM_ARG
2252 #define YYPARSE_PARAM_DECL
2253 #endif /* not YYPARSE_PARAM */
2255 /* Prevent warning if -Wstrict-prototypes. */
2257 #ifdef YYPARSE_PARAM
2258 int yyparse (void *);
2265 yyparse(YYPARSE_PARAM_ARG)
2268 register int yystate;
2270 register short *yyssp;
2271 register YYSTYPE *yyvsp;
2272 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2273 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2275 short yyssa[YYINITDEPTH]; /* the state stack */
2276 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2278 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2279 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2282 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2283 YYLTYPE *yyls = yylsa;
2286 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2288 #define YYPOPSTACK (yyvsp--, yyssp--)
2291 int yystacksize = YYINITDEPTH;
2292 int yyfree_stacks = 0;
2303 YYSTYPE yyval; /* the variable used to return */
2304 /* semantic values from the action */
2311 fprintf(stderr, "Starting parse\n");
2317 yychar = YYEMPTY; /* Cause a token to be read. */
2319 /* Initialize stack pointers.
2320 Waste one element of value and location stack
2321 so that they stay on the same level as the state stack.
2322 The wasted elements are never initialized. */
2330 /* Push a new state, which is found in yystate . */
2331 /* In all cases, when you get here, the value and location stacks
2332 have just been pushed. so pushing a state here evens the stacks. */
2337 if (yyssp >= yyss + yystacksize - 1)
2339 /* Give user a chance to reallocate the stack */
2340 /* Use copies of these so that the &'s don't force the real ones into memory. */
2341 YYSTYPE *yyvs1 = yyvs;
2342 short *yyss1 = yyss;
2344 YYLTYPE *yyls1 = yyls;
2347 /* Get the current used size of the three stacks, in elements. */
2348 int size = yyssp - yyss + 1;
2351 /* Each stack pointer address is followed by the size of
2352 the data in use in that stack, in bytes. */
2354 /* This used to be a conditional around just the two extra args,
2355 but that might be undefined if yyoverflow is a macro. */
2356 yyoverflow("parser stack overflow",
2357 &yyss1, size * sizeof (*yyssp),
2358 &yyvs1, size * sizeof (*yyvsp),
2359 &yyls1, size * sizeof (*yylsp),
2362 yyoverflow("parser stack overflow",
2363 &yyss1, size * sizeof (*yyssp),
2364 &yyvs1, size * sizeof (*yyvsp),
2368 yyss = yyss1; yyvs = yyvs1;
2372 #else /* no yyoverflow */
2373 /* Extend the stack our own way. */
2374 if (yystacksize >= YYMAXDEPTH)
2376 yyerror("parser stack overflow");
2388 if (yystacksize > YYMAXDEPTH)
2389 yystacksize = YYMAXDEPTH;
2390 #ifndef YYSTACK_USE_ALLOCA
2393 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2394 __yy_memcpy ((char *)yyss, (char *)yyss1,
2395 size * (unsigned int) sizeof (*yyssp));
2396 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2397 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2398 size * (unsigned int) sizeof (*yyvsp));
2400 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2401 __yy_memcpy ((char *)yyls, (char *)yyls1,
2402 size * (unsigned int) sizeof (*yylsp));
2404 #endif /* no yyoverflow */
2406 yyssp = yyss + size - 1;
2407 yyvsp = yyvs + size - 1;
2409 yylsp = yyls + size - 1;
2414 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2417 if (yyssp >= yyss + yystacksize - 1)
2423 fprintf(stderr, "Entering state %d\n", yystate);
2429 /* Do appropriate processing given the current state. */
2430 /* Read a lookahead token if we need one and don't already have one. */
2433 /* First try to decide what to do without reference to lookahead token. */
2435 yyn = yypact[yystate];
2439 /* Not known => get a lookahead token if don't already have one. */
2441 /* yychar is either YYEMPTY or YYEOF
2442 or a valid token in external form. */
2444 if (yychar == YYEMPTY)
2448 fprintf(stderr, "Reading a token: ");
2453 /* Convert token to internal form (in yychar1) for indexing tables with */
2455 if (yychar <= 0) /* This means end of input. */
2458 yychar = YYEOF; /* Don't call YYLEX any more */
2462 fprintf(stderr, "Now at end of input.\n");
2467 yychar1 = YYTRANSLATE(yychar);
2472 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2473 /* Give the individual parser a way to print the precise meaning
2474 of a token, for further debugging info. */
2476 YYPRINT (stderr, yychar, yylval);
2478 fprintf (stderr, ")\n");
2484 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2489 /* yyn is what to do for this token type in this state.
2490 Negative => reduce, -yyn is rule number.
2491 Positive => shift, yyn is new state.
2492 New state is final state => don't bother to shift,
2493 just return success.
2494 0, or most negative number => error. */
2509 /* Shift the lookahead token. */
2513 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2516 /* Discard the token being shifted unless it is eof. */
2517 if (yychar != YYEOF)
2525 /* count tokens shifted since error; after three, turn off error status. */
2526 if (yyerrstatus) yyerrstatus--;
2531 /* Do the default action for the current state. */
2534 yyn = yydefact[yystate];
2538 /* Do a reduction. yyn is the number of a rule to reduce with. */
2542 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2549 fprintf (stderr, "Reducing via rule %d (line %d), ",
2552 /* Print the symbols being reduced, and their result. */
2553 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2554 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2555 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2563 #line 1133 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2564 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2567 #line 1133 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2568 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2571 #line 1134 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2572 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2575 #line 1134 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2576 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2579 #line 1135 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2580 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2583 #line 1135 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2584 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2587 #line 1136 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2588 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2591 #line 1136 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2592 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2595 #line 1137 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2596 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2599 #line 1137 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2600 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2603 #line 1141 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2604 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2607 #line 1141 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2608 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2611 #line 1142 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2612 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2615 #line 1142 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2616 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2619 #line 1143 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2620 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2623 #line 1143 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2624 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2627 #line 1144 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2628 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2631 #line 1144 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2632 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2635 #line 1145 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2636 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2639 #line 1145 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2640 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2643 #line 1146 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2644 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2647 #line 1146 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2648 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2651 #line 1147 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2652 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2655 #line 1147 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2656 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2659 #line 1148 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2660 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2663 #line 1149 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2664 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2667 #line 1158 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2668 { yyval.StrVal = 0; ;
2671 #line 1162 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2673 yyval.StrVal = yyvsp[-1].StrVal;
2678 #line 1166 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2685 #line 1174 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2692 #line 1179 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2694 yyval.StrVal = yyvsp[-1].StrVal;
2699 #line 1185 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2700 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2703 #line 1186 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2704 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2707 #line 1187 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2708 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2711 #line 1188 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2712 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2715 #line 1189 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2716 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2719 #line 1193 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2720 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2723 #line 1194 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2724 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2727 #line 1195 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2728 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2731 #line 1199 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2732 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2735 #line 1200 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2736 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2739 #line 1201 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2740 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2743 #line 1202 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2744 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2747 #line 1206 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2748 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2751 #line 1207 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2752 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2755 #line 1208 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2756 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2759 #line 1212 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2760 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2763 #line 1213 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2764 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2767 #line 1214 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2768 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2771 #line 1215 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2772 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2775 #line 1216 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2776 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2779 #line 1220 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2780 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2783 #line 1221 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2784 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2787 #line 1222 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2788 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2791 #line 1225 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2792 { yyval.UIntVal = CallingConv::C; ;
2795 #line 1226 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2796 { yyval.UIntVal = CallingConv::C; ;
2799 #line 1227 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2800 { yyval.UIntVal = CallingConv::Fast; ;
2803 #line 1228 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2804 { yyval.UIntVal = CallingConv::Cold; ;
2807 #line 1229 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2808 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2811 #line 1230 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2812 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2815 #line 1231 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2817 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2818 GEN_ERROR("Calling conv too large");
2819 yyval.UIntVal = yyvsp[0].UInt64Val;
2824 #line 1238 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2825 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2828 #line 1239 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2829 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2832 #line 1240 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2833 { yyval.ParamAttrs = ParamAttr::SExt; ;
2836 #line 1241 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2837 { yyval.ParamAttrs = ParamAttr::SExt; ;
2840 #line 1242 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2841 { yyval.ParamAttrs = ParamAttr::InReg; ;
2844 #line 1243 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2845 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2848 #line 1244 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2849 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2852 #line 1245 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2853 { yyval.ParamAttrs = ParamAttr::ByVal; ;
2856 #line 1246 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2857 { yyval.ParamAttrs = ParamAttr::Nest; ;
2860 #line 1249 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2861 { yyval.ParamAttrs = ParamAttr::None; ;
2864 #line 1250 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2866 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2870 #line 1255 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2871 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2874 #line 1256 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2875 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2878 #line 1257 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2879 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2882 #line 1258 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2883 { yyval.ParamAttrs = ParamAttr::SExt; ;
2886 #line 1261 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2887 { yyval.ParamAttrs = ParamAttr::None; ;
2890 #line 1262 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2892 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2896 #line 1269 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2897 { yyval.UIntVal = 0; ;
2900 #line 1270 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2902 yyval.UIntVal = yyvsp[0].UInt64Val;
2903 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2904 GEN_ERROR("Alignment must be a power of two");
2909 #line 1276 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2910 { yyval.UIntVal = 0; ;
2913 #line 1277 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2915 yyval.UIntVal = yyvsp[0].UInt64Val;
2916 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2917 GEN_ERROR("Alignment must be a power of two");
2922 #line 1285 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2924 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2925 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2926 GEN_ERROR("Invalid character in section name");
2927 yyval.StrVal = yyvsp[0].StrVal;
2932 #line 1293 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2933 { yyval.StrVal = 0; ;
2936 #line 1294 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2937 { yyval.StrVal = yyvsp[0].StrVal; ;
2940 #line 1299 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2944 #line 1300 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2948 #line 1301 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2950 CurGV->setSection(*yyvsp[0].StrVal);
2951 delete yyvsp[0].StrVal;
2956 #line 1306 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2958 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2959 GEN_ERROR("Alignment must be a power of two");
2960 CurGV->setAlignment(yyvsp[0].UInt64Val);
2965 #line 1322 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2967 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2972 #line 1326 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2974 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2979 #line 1330 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2981 if (*yyvsp[-1].TypeVal == Type::LabelTy)
2982 GEN_ERROR("Cannot form a pointer to a basic block");
2983 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2984 delete yyvsp[-1].TypeVal;
2989 #line 1337 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2990 { // Named types are also simple types...
2991 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
2993 yyval.TypeVal = new PATypeHolder(tmp);
2997 #line 1342 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
2998 { // Type UpReference
2999 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
3000 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3001 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3002 yyval.TypeVal = new PATypeHolder(OT);
3003 UR_OUT("New Upreference!\n");
3008 #line 1350 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3010 std::vector<const Type*> Params;
3011 ParamAttrsVector Attrs;
3012 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3013 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3017 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3018 for (; I != E; ++I, ++index) {
3019 const Type *Ty = I->Ty->get();
3020 Params.push_back(Ty);
3021 if (Ty != Type::VoidTy)
3022 if (I->Attrs != ParamAttr::None) {
3023 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3027 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3028 if (isVarArg) Params.pop_back();
3030 ParamAttrsList *ActualAttrs = 0;
3032 ActualAttrs = ParamAttrsList::get(Attrs);
3033 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3034 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3035 delete yyvsp[-4].TypeVal; // Delete the return type handle
3036 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3041 #line 1380 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3043 std::vector<const Type*> Params;
3044 ParamAttrsVector Attrs;
3045 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3046 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3049 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3051 for ( ; I != E; ++I, ++index) {
3052 const Type* Ty = I->Ty->get();
3053 Params.push_back(Ty);
3054 if (Ty != Type::VoidTy)
3055 if (I->Attrs != ParamAttr::None) {
3056 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3060 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3061 if (isVarArg) Params.pop_back();
3063 ParamAttrsList *ActualAttrs = 0;
3065 ActualAttrs = ParamAttrsList::get(Attrs);
3067 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3068 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3069 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3074 #line 1411 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3075 { // Sized array type?
3076 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3077 delete yyvsp[-1].TypeVal;
3082 #line 1416 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3084 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3085 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3086 GEN_ERROR("Unsigned result not equal to signed result");
3087 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3088 GEN_ERROR("Element type of a VectorType must be primitive");
3089 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3090 GEN_ERROR("Vector length should be a power of 2");
3091 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3092 delete yyvsp[-1].TypeVal;
3097 #line 1428 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3098 { // Structure type?
3099 std::vector<const Type*> Elements;
3100 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3101 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3102 Elements.push_back(*I);
3104 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3105 delete yyvsp[-1].TypeList;
3110 #line 1438 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3111 { // Empty structure type?
3112 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3117 #line 1442 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3119 std::vector<const Type*> Elements;
3120 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3121 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3122 Elements.push_back(*I);
3124 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3125 delete yyvsp[-2].TypeList;
3130 #line 1452 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3131 { // Empty structure type?
3132 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3137 #line 1459 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3139 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3140 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3144 #line 1466 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3146 if (!UpRefs.empty())
3147 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3148 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3149 GEN_ERROR("LLVM functions cannot return aggregate types");
3150 yyval.TypeVal = yyvsp[0].TypeVal;
3154 #line 1473 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3156 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3160 #line 1478 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3162 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3163 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3168 #line 1483 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3170 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3175 #line 1491 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3177 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3178 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3179 TWA.Ty = new PATypeHolder(Type::VoidTy);
3180 yyval.TypeWithAttrsList->push_back(TWA);
3185 #line 1498 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3187 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3188 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3189 TWA.Ty = new PATypeHolder(Type::VoidTy);
3190 yyval.TypeWithAttrsList->push_back(TWA);
3195 #line 1505 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3197 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3202 #line 1513 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3204 yyval.TypeList = new std::list<PATypeHolder>();
3205 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3206 delete yyvsp[0].TypeVal;
3211 #line 1519 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3213 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3214 delete yyvsp[0].TypeVal;
3219 #line 1531 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3220 { // Nonempty unsized arr
3221 if (!UpRefs.empty())
3222 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3223 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3225 GEN_ERROR("Cannot make array constant with type: '" +
3226 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3227 const Type *ETy = ATy->getElementType();
3228 int NumElements = ATy->getNumElements();
3230 // Verify that we have the correct size...
3231 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3232 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3233 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3234 itostr(NumElements) + "");
3236 // Verify all elements are correct type!
3237 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3238 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3239 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3240 ETy->getDescription() +"' as required!\nIt is of type '"+
3241 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3244 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3245 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3250 #line 1559 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3252 if (!UpRefs.empty())
3253 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3254 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3256 GEN_ERROR("Cannot make array constant with type: '" +
3257 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3259 int NumElements = ATy->getNumElements();
3260 if (NumElements != -1 && NumElements != 0)
3261 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3262 " arguments, but has size of " + itostr(NumElements) +"");
3263 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3264 delete yyvsp[-2].TypeVal;
3269 #line 1575 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3271 if (!UpRefs.empty())
3272 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3273 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3275 GEN_ERROR("Cannot make array constant with type: '" +
3276 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3278 int NumElements = ATy->getNumElements();
3279 const Type *ETy = ATy->getElementType();
3280 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3281 GEN_ERROR("Can't build string constant of size " +
3282 itostr((int)(yyvsp[0].StrVal->length())) +
3283 " when array has size " + itostr(NumElements) + "");
3284 std::vector<Constant*> Vals;
3285 if (ETy == Type::Int8Ty) {
3286 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3287 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3289 delete yyvsp[0].StrVal;
3290 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3292 delete yyvsp[0].StrVal;
3293 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3294 delete yyvsp[-2].TypeVal;
3299 #line 1602 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3300 { // Nonempty unsized arr
3301 if (!UpRefs.empty())
3302 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3303 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3305 GEN_ERROR("Cannot make packed constant with type: '" +
3306 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3307 const Type *ETy = PTy->getElementType();
3308 int NumElements = PTy->getNumElements();
3310 // Verify that we have the correct size...
3311 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3312 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3313 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3314 itostr(NumElements) + "");
3316 // Verify all elements are correct type!
3317 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3318 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3319 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3320 ETy->getDescription() +"' as required!\nIt is of type '"+
3321 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3324 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3325 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3330 #line 1630 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3332 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3334 GEN_ERROR("Cannot make struct constant with type: '" +
3335 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3337 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3338 GEN_ERROR("Illegal number of initializers for structure type");
3340 // Check to ensure that constants are compatible with the type initializer!
3341 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3342 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3343 GEN_ERROR("Expected type '" +
3344 STy->getElementType(i)->getDescription() +
3345 "' for element #" + utostr(i) +
3346 " of structure initializer");
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, *yyvsp[-1].ConstVector);
3354 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3359 #line 1656 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3361 if (!UpRefs.empty())
3362 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3363 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3365 GEN_ERROR("Cannot make struct constant with type: '" +
3366 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3368 if (STy->getNumContainedTypes() != 0)
3369 GEN_ERROR("Illegal number of initializers for structure type");
3371 // Check to ensure that Type is not packed
3372 if (STy->isPacked())
3373 GEN_ERROR("Unpacked Initializer to vector type '" +
3374 STy->getDescription() + "'");
3376 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3377 delete yyvsp[-2].TypeVal;
3382 #line 1676 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3384 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3386 GEN_ERROR("Cannot make struct constant with type: '" +
3387 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3389 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3390 GEN_ERROR("Illegal number of initializers for structure type");
3392 // Check to ensure that constants are compatible with the type initializer!
3393 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3394 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3395 GEN_ERROR("Expected type '" +
3396 STy->getElementType(i)->getDescription() +
3397 "' for element #" + utostr(i) +
3398 " of structure initializer");
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, *yyvsp[-2].ConstVector);
3406 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3411 #line 1702 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3413 if (!UpRefs.empty())
3414 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3415 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3417 GEN_ERROR("Cannot make struct constant with type: '" +
3418 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3420 if (STy->getNumContainedTypes() != 0)
3421 GEN_ERROR("Illegal number of initializers for structure type");
3423 // Check to ensure that Type is packed
3424 if (!STy->isPacked())
3425 GEN_ERROR("Vector initializer to non-vector type '" +
3426 STy->getDescription() + "'");
3428 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3429 delete yyvsp[-4].TypeVal;
3434 #line 1722 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3436 if (!UpRefs.empty())
3437 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3438 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3440 GEN_ERROR("Cannot make null pointer constant with type: '" +
3441 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3443 yyval.ConstVal = ConstantPointerNull::get(PTy);
3444 delete yyvsp[-1].TypeVal;
3449 #line 1734 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3451 if (!UpRefs.empty())
3452 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3453 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3454 delete yyvsp[-1].TypeVal;
3459 #line 1741 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3461 if (!UpRefs.empty())
3462 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3463 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3465 GEN_ERROR("Global const reference must be a pointer type");
3467 // ConstExprs can exist in the body of a function, thus creating
3468 // GlobalValues whenever they refer to a variable. Because we are in
3469 // the context of a function, getExistingVal will search the functions
3470 // symbol table instead of the module symbol table for the global symbol,
3471 // which throws things all off. To get around this, we just tell
3472 // getExistingVal that we are at global scope here.
3474 Function *SavedCurFn = CurFun.CurrentFunction;
3475 CurFun.CurrentFunction = 0;
3477 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3480 CurFun.CurrentFunction = SavedCurFn;
3482 // If this is an initializer for a constant pointer, which is referencing a
3483 // (currently) undefined variable, create a stub now that shall be replaced
3484 // in the future with the right type of variable.
3487 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3488 const PointerType *PT = cast<PointerType>(Ty);
3490 // First check to see if the forward references value is already created!
3491 PerModuleInfo::GlobalRefsType::iterator I =
3492 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3494 if (I != CurModule.GlobalRefs.end()) {
3495 V = I->second; // Placeholder already exists, use it...
3496 yyvsp[0].ValIDVal.destroy();
3499 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3500 Name = yyvsp[0].ValIDVal.getName();
3501 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3502 GEN_ERROR("Invalid reference to global");
3504 // Create the forward referenced global.
3506 if (const FunctionType *FTy =
3507 dyn_cast<FunctionType>(PT->getElementType())) {
3508 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3509 CurModule.CurrentModule);
3511 GV = new GlobalVariable(PT->getElementType(), false,
3512 GlobalValue::ExternalWeakLinkage, 0,
3513 Name, CurModule.CurrentModule);
3516 // Keep track of the fact that we have a forward ref to recycle it
3517 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3522 yyval.ConstVal = cast<GlobalValue>(V);
3523 delete yyvsp[-1].TypeVal; // Free the type handle
3528 #line 1807 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3530 if (!UpRefs.empty())
3531 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3532 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3533 GEN_ERROR("Mismatched types for constant expression: " +
3534 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3535 yyval.ConstVal = yyvsp[0].ConstVal;
3536 delete yyvsp[-1].TypeVal;
3541 #line 1817 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3543 if (!UpRefs.empty())
3544 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3545 const Type *Ty = yyvsp[-1].TypeVal->get();
3546 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3547 GEN_ERROR("Cannot create a null initialized value of this type");
3548 yyval.ConstVal = Constant::getNullValue(Ty);
3549 delete yyvsp[-1].TypeVal;
3554 #line 1827 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3555 { // integral constants
3556 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3557 GEN_ERROR("Constant value doesn't fit in type");
3558 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3563 #line 1833 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3564 { // arbitrary precision integer constants
3565 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3566 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3567 GEN_ERROR("Constant value does not fit in type");
3569 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3570 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3571 delete yyvsp[0].APIntVal;
3576 #line 1843 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3577 { // integral constants
3578 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3579 GEN_ERROR("Constant value doesn't fit in type");
3580 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3585 #line 1849 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3586 { // arbitrary precision integer constants
3587 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3588 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3589 GEN_ERROR("Constant value does not fit in type");
3591 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3592 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3593 delete yyvsp[0].APIntVal;
3598 #line 1859 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3599 { // Boolean constants
3600 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3601 yyval.ConstVal = ConstantInt::getTrue();
3606 #line 1864 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3607 { // Boolean constants
3608 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3609 yyval.ConstVal = ConstantInt::getFalse();
3614 #line 1869 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3615 { // Floating point constants
3616 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
3617 GEN_ERROR("Floating point constant invalid for type");
3618 // Lexer has no type info, so builds all float and double FP constants
3619 // as double. Fix this here. Long double is done right.
3620 if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy)
3621 yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
3622 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
3623 delete yyvsp[0].FPVal;
3628 #line 1882 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3630 if (!UpRefs.empty())
3631 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3632 Constant *Val = yyvsp[-3].ConstVal;
3633 const Type *DestTy = yyvsp[-1].TypeVal->get();
3634 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3635 GEN_ERROR("invalid cast opcode for cast from '" +
3636 Val->getType()->getDescription() + "' to '" +
3637 DestTy->getDescription() + "'");
3638 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3639 delete yyvsp[-1].TypeVal;
3643 #line 1894 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3645 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3646 GEN_ERROR("GetElementPtr requires a pointer operand");
3649 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
3652 GEN_ERROR("Index list invalid for constant getelementptr");
3654 SmallVector<Constant*, 8> IdxVec;
3655 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3656 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3657 IdxVec.push_back(C);
3659 GEN_ERROR("Indices to constant getelementptr must be constants");
3661 delete yyvsp[-1].ValueList;
3663 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3668 #line 1916 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3670 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3671 GEN_ERROR("Select condition must be of boolean type");
3672 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3673 GEN_ERROR("Select operand types must match");
3674 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3679 #line 1924 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3681 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3682 GEN_ERROR("Binary operator types must match");
3684 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3688 #line 1930 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3690 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3691 GEN_ERROR("Logical operator types must match");
3692 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3693 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3694 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3695 GEN_ERROR("Logical operator requires integral operands");
3697 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3702 #line 1941 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3704 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3705 GEN_ERROR("icmp operand types must match");
3706 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3710 #line 1946 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3712 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3713 GEN_ERROR("fcmp operand types must match");
3714 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3718 #line 1951 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3720 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3721 GEN_ERROR("Invalid extractelement operands");
3722 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3727 #line 1957 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3729 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3730 GEN_ERROR("Invalid insertelement operands");
3731 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3736 #line 1963 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3738 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3739 GEN_ERROR("Invalid shufflevector operands");
3740 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3745 #line 1972 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3747 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3752 #line 1976 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3754 yyval.ConstVector = new std::vector<Constant*>();
3755 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3760 #line 1984 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3761 { yyval.BoolVal = false; ;
3764 #line 1984 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3765 { yyval.BoolVal = true; ;
3768 #line 1987 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3769 { yyval.BoolVal = true; ;
3772 #line 1987 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3773 { yyval.BoolVal = false; ;
3776 #line 1990 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3778 const Type* VTy = yyvsp[-1].TypeVal->get();
3779 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3781 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3783 GEN_ERROR("Aliases can be created only to global values");
3785 yyval.ConstVal = Aliasee;
3787 delete yyvsp[-1].TypeVal;
3791 #line 2002 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3793 Constant *Val = yyvsp[-3].ConstVal;
3794 const Type *DestTy = yyvsp[-1].TypeVal->get();
3795 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3796 GEN_ERROR("invalid cast opcode for cast from '" +
3797 Val->getType()->getDescription() + "' to '" +
3798 DestTy->getDescription() + "'");
3800 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3802 delete yyvsp[-1].TypeVal;
3806 #line 2023 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3808 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3809 CurModule.ModuleDone();
3814 #line 2028 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3816 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3817 CurModule.ModuleDone();
3822 #line 2041 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3823 { CurFun.isDeclare = false; ;
3826 #line 2041 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3828 CurFun.FunctionDone();
3833 #line 2045 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3834 { CurFun.isDeclare = true; ;
3837 #line 2045 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3843 #line 2048 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3849 #line 2051 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3851 if (!UpRefs.empty())
3852 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3853 // Eagerly resolve types. This is not an optimization, this is a
3854 // requirement that is due to the fact that we could have this:
3856 // %list = type { %list * }
3857 // %list = type { %list * } ; repeated type decl
3859 // If types are not resolved eagerly, then the two types will not be
3860 // determined to be the same type!
3862 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3864 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3866 // If this is a named type that is not a redefinition, add it to the slot
3868 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3871 delete yyvsp[0].TypeVal;
3876 #line 2075 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3878 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3880 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3882 // If this is a named type that is not a redefinition, add it to the slot
3884 CurModule.Types.push_back(yyvsp[0].PrimType);
3890 #line 2086 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3892 /* "Externally Visible" Linkage */
3893 if (yyvsp[0].ConstVal == 0)
3894 GEN_ERROR("Global value initializer is not a constant");
3895 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3896 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3901 #line 2093 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3907 #line 2097 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3909 if (yyvsp[0].ConstVal == 0)
3910 GEN_ERROR("Global value initializer is not a constant");
3911 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3916 #line 2102 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3922 #line 2106 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3924 if (!UpRefs.empty())
3925 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3926 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
3928 delete yyvsp[0].TypeVal;
3932 #line 2112 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3939 #line 2116 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3942 if (yyvsp[-4].StrVal) {
3943 Name = *yyvsp[-4].StrVal;
3944 delete yyvsp[-4].StrVal;
3947 GEN_ERROR("Alias name cannot be empty");
3949 Constant* Aliasee = yyvsp[0].ConstVal;
3951 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3953 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
3954 CurModule.CurrentModule);
3955 GA->setVisibility(yyvsp[-3].Visibility);
3956 InsertValue(GA, CurModule.Values);
3959 // If there was a forward reference of this alias, resolve it now.
3963 ID = ValID::createGlobalName(Name);
3965 ID = ValID::createGlobalID(CurModule.Values.size()-1);
3967 if (GlobalValue *FWGV =
3968 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
3969 // Replace uses of the fwdref with the actual alias.
3970 FWGV->replaceAllUsesWith(GA);
3971 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
3972 GV->eraseFromParent();
3974 cast<Function>(FWGV)->eraseFromParent();
3982 #line 2156 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3988 #line 2159 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3994 #line 2165 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
3996 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3997 if (AsmSoFar.empty())
3998 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
4000 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
4001 delete yyvsp[0].StrVal;
4006 #line 2175 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4008 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
4009 delete yyvsp[0].StrVal;
4013 #line 2179 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4015 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
4016 delete yyvsp[0].StrVal;
4020 #line 2186 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4022 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4023 delete yyvsp[0].StrVal;
4028 #line 2191 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4030 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4031 delete yyvsp[0].StrVal;
4036 #line 2196 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4042 #line 2205 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4044 if (!UpRefs.empty())
4045 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4046 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4047 GEN_ERROR("void typed arguments are invalid");
4048 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4049 yyval.ArgList = yyvsp[-4].ArgList;
4050 yyvsp[-4].ArgList->push_back(E);
4055 #line 2215 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4057 if (!UpRefs.empty())
4058 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4059 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4060 GEN_ERROR("void typed arguments are invalid");
4061 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4062 yyval.ArgList = new ArgListType;
4063 yyval.ArgList->push_back(E);
4068 #line 2226 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4070 yyval.ArgList = yyvsp[0].ArgList;
4075 #line 2230 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4077 yyval.ArgList = yyvsp[-2].ArgList;
4078 struct ArgListEntry E;
4079 E.Ty = new PATypeHolder(Type::VoidTy);
4081 E.Attrs = ParamAttr::None;
4082 yyval.ArgList->push_back(E);
4087 #line 2239 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4089 yyval.ArgList = new ArgListType;
4090 struct ArgListEntry E;
4091 E.Ty = new PATypeHolder(Type::VoidTy);
4093 E.Attrs = ParamAttr::None;
4094 yyval.ArgList->push_back(E);
4099 #line 2248 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4106 #line 2254 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4108 std::string FunctionName(*yyvsp[-6].StrVal);
4109 delete yyvsp[-6].StrVal; // Free strdup'd memory!
4111 // Check the function result for abstractness if this is a define. We should
4112 // have no abstract types at this point
4113 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4114 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4116 std::vector<const Type*> ParamTypeList;
4117 ParamAttrsVector Attrs;
4118 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4119 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4120 Attrs.push_back(PAWI);
4122 if (yyvsp[-4].ArgList) { // If there are arguments...
4124 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4125 const Type* Ty = I->Ty->get();
4126 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4127 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4128 ParamTypeList.push_back(Ty);
4129 if (Ty != Type::VoidTy)
4130 if (I->Attrs != ParamAttr::None) {
4131 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4132 Attrs.push_back(PAWI);
4137 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4138 if (isVarArg) ParamTypeList.pop_back();
4140 ParamAttrsList *PAL = 0;
4142 PAL = ParamAttrsList::get(Attrs);
4144 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4145 const PointerType *PFT = PointerType::get(FT);
4146 delete yyvsp[-7].TypeVal;
4149 if (!FunctionName.empty()) {
4150 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4152 ID = ValID::createGlobalID(CurModule.Values.size());
4156 // See if this function was forward referenced. If so, recycle the object.
4157 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4158 // Move the function to the end of the list, from whereever it was
4159 // previously inserted.
4160 Fn = cast<Function>(FWRef);
4161 CurModule.CurrentModule->getFunctionList().remove(Fn);
4162 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4163 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4164 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4165 if (Fn->getFunctionType() != FT) {
4166 // The existing function doesn't have the same type. This is an overload
4168 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4169 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4170 // Neither the existing or the current function is a declaration and they
4171 // have the same name and same type. Clearly this is a redefinition.
4172 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4173 } if (Fn->isDeclaration()) {
4174 // Make sure to strip off any argument names so we can't get conflicts.
4175 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4179 } else { // Not already defined?
4180 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4181 CurModule.CurrentModule);
4183 InsertValue(Fn, CurModule.Values);
4186 CurFun.FunctionStart(Fn);
4188 if (CurFun.isDeclare) {
4189 // If we have declaration, always overwrite linkage. This will allow us to
4190 // correctly handle cases, when pointer to function is passed as argument to
4191 // another function.
4192 Fn->setLinkage(CurFun.Linkage);
4193 Fn->setVisibility(CurFun.Visibility);
4195 Fn->setCallingConv(yyvsp[-8].UIntVal);
4196 Fn->setAlignment(yyvsp[0].UIntVal);
4197 if (yyvsp[-1].StrVal) {
4198 Fn->setSection(*yyvsp[-1].StrVal);
4199 delete yyvsp[-1].StrVal;
4202 // Add all of the arguments we parsed to the function...
4203 if (yyvsp[-4].ArgList) { // Is null if empty...
4204 if (isVarArg) { // Nuke the last entry
4205 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4206 "Not a varargs marker!");
4207 delete yyvsp[-4].ArgList->back().Ty;
4208 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4210 Function::arg_iterator ArgIt = Fn->arg_begin();
4211 Function::arg_iterator ArgEnd = Fn->arg_end();
4213 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4214 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4215 delete I->Ty; // Delete the typeholder...
4216 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4222 delete yyvsp[-4].ArgList; // We're now done with the argument list
4228 #line 2376 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4230 yyval.FunctionVal = CurFun.CurrentFunction;
4232 // Make sure that we keep track of the linkage type even if there was a
4233 // previous "declare".
4234 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4235 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4239 #line 2387 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4241 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4246 #line 2392 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4248 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4249 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4250 yyval.FunctionVal = CurFun.CurrentFunction;
4251 CurFun.FunctionDone();
4256 #line 2404 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4258 yyval.BoolVal = false;
4263 #line 2408 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4265 yyval.BoolVal = true;
4270 #line 2413 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4271 { // A reference to a direct constant
4272 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4277 #line 2417 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4279 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4284 #line 2421 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4285 { // Perhaps it's an FP constant?
4286 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4291 #line 2425 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4293 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4298 #line 2429 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4300 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4305 #line 2433 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4307 yyval.ValIDVal = ValID::createNull();
4312 #line 2437 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4314 yyval.ValIDVal = ValID::createUndef();
4319 #line 2441 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4320 { // A vector zero constant.
4321 yyval.ValIDVal = ValID::createZeroInit();
4326 #line 2445 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4327 { // Nonempty unsized packed vector
4328 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4329 int NumElements = yyvsp[-1].ConstVector->size();
4331 VectorType* pt = VectorType::get(ETy, NumElements);
4332 PATypeHolder* PTy = new PATypeHolder(
4340 // Verify all elements are correct type!
4341 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4342 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4343 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4344 ETy->getDescription() +"' as required!\nIt is of type '" +
4345 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4348 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4349 delete PTy; delete yyvsp[-1].ConstVector;
4354 #line 2470 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4356 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4361 #line 2474 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4363 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4364 delete yyvsp[-2].StrVal;
4365 delete yyvsp[0].StrVal;
4370 #line 2484 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4371 { // Is it an integer reference...?
4372 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4377 #line 2488 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4379 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4384 #line 2492 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4385 { // Is it a named reference...?
4386 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4387 delete yyvsp[0].StrVal;
4392 #line 2497 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4393 { // Is it a named reference...?
4394 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4395 delete yyvsp[0].StrVal;
4400 #line 2510 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4402 if (!UpRefs.empty())
4403 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4404 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4405 delete yyvsp[-1].TypeVal;
4410 #line 2519 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4412 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4417 #line 2523 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4418 { // Do not allow functions with 0 basic blocks
4419 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4424 #line 2532 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4426 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4428 InsertValue(yyvsp[0].TermInstVal);
4429 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4430 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4435 #line 2541 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4437 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4438 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4439 if (CI2->getParent() == 0)
4440 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4441 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4442 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4447 #line 2550 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4448 { // Empty space between instruction lists
4449 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4454 #line 2554 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4455 { // Labelled (named) basic block
4456 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4457 delete yyvsp[0].StrVal;
4463 #line 2561 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4464 { // Return with a result...
4465 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4470 #line 2565 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4471 { // Return with no result...
4472 yyval.TermInstVal = new ReturnInst();
4477 #line 2569 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4478 { // Unconditional Branch...
4479 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4481 yyval.TermInstVal = new BranchInst(tmpBB);
4485 #line 2574 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4487 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4488 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4490 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4492 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4494 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4498 #line 2584 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4500 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4502 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4504 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4505 yyval.TermInstVal = S;
4507 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4508 E = yyvsp[-1].JumpTable->end();
4509 for (; I != E; ++I) {
4510 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4511 S->addCase(CI, I->second);
4513 GEN_ERROR("Switch case is constant, but not a simple integer");
4515 delete yyvsp[-1].JumpTable;
4520 #line 2603 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4522 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4524 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4526 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4527 yyval.TermInstVal = S;
4532 #line 2613 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4535 // Handle the short syntax
4536 const PointerType *PFTy = 0;
4537 const FunctionType *Ty = 0;
4538 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4539 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4540 // Pull out the types of all of the arguments...
4541 std::vector<const Type*> ParamTypes;
4542 ParamAttrsVector Attrs;
4543 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4544 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4545 Attrs.push_back(PAWI);
4547 ParamList::iterator I = yyvsp[-8].ParamList->begin(), E = yyvsp[-8].ParamList->end();
4549 for (; I != E; ++I, ++index) {
4550 const Type *Ty = I->Val->getType();
4551 if (Ty == Type::VoidTy)
4552 GEN_ERROR("Short call syntax cannot be used with varargs");
4553 ParamTypes.push_back(Ty);
4554 if (I->Attrs != ParamAttr::None) {
4555 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4556 Attrs.push_back(PAWI);
4560 ParamAttrsList *PAL = 0;
4562 PAL = ParamAttrsList::get(Attrs);
4563 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
4564 PFTy = PointerType::get(Ty);
4567 delete yyvsp[-11].TypeVal;
4569 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4571 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4573 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4576 // Check the arguments
4578 if (yyvsp[-8].ParamList->empty()) { // Has no arguments?
4579 // Make sure no arguments is a good thing!
4580 if (Ty->getNumParams() != 0)
4581 GEN_ERROR("No arguments passed to a function that "
4582 "expects arguments");
4583 } else { // Has arguments?
4584 // Loop through FunctionType's arguments and ensure they are specified
4586 FunctionType::param_iterator I = Ty->param_begin();
4587 FunctionType::param_iterator E = Ty->param_end();
4588 ParamList::iterator ArgI = yyvsp[-8].ParamList->begin(), ArgE = yyvsp[-8].ParamList->end();
4590 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4591 if (ArgI->Val->getType() != *I)
4592 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4593 (*I)->getDescription() + "'");
4594 Args.push_back(ArgI->Val);
4597 if (Ty->isVarArg()) {
4599 for (; ArgI != ArgE; ++ArgI)
4600 Args.push_back(ArgI->Val); // push the remaining varargs
4601 } else if (I != E || ArgI != ArgE)
4602 GEN_ERROR("Invalid number of parameters detected");
4605 // Create the InvokeInst
4606 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
4607 II->setCallingConv(yyvsp[-12].UIntVal);
4608 yyval.TermInstVal = II;
4609 delete yyvsp[-8].ParamList;
4614 #line 2692 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4616 yyval.TermInstVal = new UnwindInst();
4621 #line 2696 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4623 yyval.TermInstVal = new UnreachableInst();
4628 #line 2703 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4630 yyval.JumpTable = yyvsp[-5].JumpTable;
4631 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4634 GEN_ERROR("May only switch on a constant pool value");
4636 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4638 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4642 #line 2714 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4644 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4645 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4649 GEN_ERROR("May only switch on a constant pool value");
4651 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4653 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4657 #line 2727 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4659 // Is this definition named?? if so, assign the name...
4660 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4662 InsertValue(yyvsp[0].InstVal);
4663 yyval.InstVal = yyvsp[0].InstVal;
4668 #line 2737 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4669 { // Used for PHI nodes
4670 if (!UpRefs.empty())
4671 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4672 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4673 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4675 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4677 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4678 delete yyvsp[-5].TypeVal;
4682 #line 2748 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4684 yyval.PHIList = yyvsp[-6].PHIList;
4685 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4687 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4689 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4693 #line 2758 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4695 if (!UpRefs.empty())
4696 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4697 // Used for call and invoke instructions
4698 yyval.ParamList = new ParamList();
4699 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4700 yyval.ParamList->push_back(E);
4701 delete yyvsp[-2].TypeVal;
4705 #line 2767 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4707 // Labels are only valid in ASMs
4708 yyval.ParamList = new ParamList();
4709 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4710 yyval.ParamList->push_back(E);
4714 #line 2773 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4716 if (!UpRefs.empty())
4717 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4718 yyval.ParamList = yyvsp[-4].ParamList;
4719 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4720 yyval.ParamList->push_back(E);
4721 delete yyvsp[-2].TypeVal;
4726 #line 2782 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4728 yyval.ParamList = yyvsp[-4].ParamList;
4729 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4730 yyval.ParamList->push_back(E);
4735 #line 2788 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4736 { yyval.ParamList = new ParamList(); ;
4739 #line 2791 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4740 { yyval.ValueList = new std::vector<Value*>(); ;
4743 #line 2792 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4745 yyval.ValueList = yyvsp[-2].ValueList;
4746 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4751 #line 2799 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4753 yyval.BoolVal = true;
4758 #line 2803 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4760 yyval.BoolVal = false;
4765 #line 2808 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4767 if (!UpRefs.empty())
4768 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4769 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4770 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4772 "Arithmetic operator requires integer, FP, or packed operands");
4773 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4774 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4775 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4776 yyvsp[-4].BinaryOpVal == Instruction::FRem))
4777 GEN_ERROR("Remainder not supported on vector types");
4778 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4780 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4782 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4783 if (yyval.InstVal == 0)
4784 GEN_ERROR("binary operator returned null");
4785 delete yyvsp[-3].TypeVal;
4789 #line 2829 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4791 if (!UpRefs.empty())
4792 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4793 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4794 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4795 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4796 GEN_ERROR("Logical operator requires integral operands");
4798 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4800 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4802 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4803 if (yyval.InstVal == 0)
4804 GEN_ERROR("binary operator returned null");
4805 delete yyvsp[-3].TypeVal;
4809 #line 2846 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4811 if (!UpRefs.empty())
4812 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4813 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4814 GEN_ERROR("Vector types not supported by icmp instruction");
4815 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4817 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4819 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4820 if (yyval.InstVal == 0)
4821 GEN_ERROR("icmp operator returned null");
4822 delete yyvsp[-3].TypeVal;
4826 #line 2860 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4828 if (!UpRefs.empty())
4829 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4830 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4831 GEN_ERROR("Vector types not supported by fcmp instruction");
4832 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4834 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4836 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4837 if (yyval.InstVal == 0)
4838 GEN_ERROR("fcmp operator returned null");
4839 delete yyvsp[-3].TypeVal;
4843 #line 2874 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4845 if (!UpRefs.empty())
4846 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4847 Value* Val = yyvsp[-2].ValueVal;
4848 const Type* DestTy = yyvsp[0].TypeVal->get();
4849 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4850 GEN_ERROR("invalid cast opcode for cast from '" +
4851 Val->getType()->getDescription() + "' to '" +
4852 DestTy->getDescription() + "'");
4853 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4854 delete yyvsp[0].TypeVal;
4858 #line 2886 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4860 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4861 GEN_ERROR("select condition must be boolean");
4862 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4863 GEN_ERROR("select value types should match");
4864 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4869 #line 2894 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4871 if (!UpRefs.empty())
4872 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4873 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4874 delete yyvsp[0].TypeVal;
4879 #line 2901 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4881 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4882 GEN_ERROR("Invalid extractelement operands");
4883 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4888 #line 2907 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4890 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4891 GEN_ERROR("Invalid insertelement operands");
4892 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4897 #line 2913 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4899 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4900 GEN_ERROR("Invalid shufflevector operands");
4901 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4906 #line 2919 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4908 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4909 if (!Ty->isFirstClassType())
4910 GEN_ERROR("PHI node operands must be of first class type");
4911 yyval.InstVal = new PHINode(Ty);
4912 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4913 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4914 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4915 GEN_ERROR("All elements of a PHI node must be of the same type");
4916 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4917 yyvsp[0].PHIList->pop_front();
4919 delete yyvsp[0].PHIList; // Free the list...
4924 #line 2935 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4927 // Handle the short syntax
4928 const PointerType *PFTy = 0;
4929 const FunctionType *Ty = 0;
4930 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
4931 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4932 // Pull out the types of all of the arguments...
4933 std::vector<const Type*> ParamTypes;
4934 ParamAttrsVector Attrs;
4935 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4936 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
4937 Attrs.push_back(PAWI);
4940 ParamList::iterator I = yyvsp[-2].ParamList->begin(), E = yyvsp[-2].ParamList->end();
4941 for (; I != E; ++I, ++index) {
4942 const Type *Ty = I->Val->getType();
4943 if (Ty == Type::VoidTy)
4944 GEN_ERROR("Short call syntax cannot be used with varargs");
4945 ParamTypes.push_back(Ty);
4946 if (I->Attrs != ParamAttr::None) {
4947 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4948 Attrs.push_back(PAWI);
4952 ParamAttrsList *PAL = 0;
4954 PAL = ParamAttrsList::get(Attrs);
4956 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
4957 PFTy = PointerType::get(Ty);
4960 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
4963 // Check for call to invalid intrinsic to avoid crashing later.
4964 if (Function *theF = dyn_cast<Function>(V)) {
4965 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4966 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4967 !theF->getIntrinsicID(true))
4968 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4969 theF->getName() + "'");
4972 // Check the arguments
4974 if (yyvsp[-2].ParamList->empty()) { // Has no arguments?
4975 // Make sure no arguments is a good thing!
4976 if (Ty->getNumParams() != 0)
4977 GEN_ERROR("No arguments passed to a function that "
4978 "expects arguments");
4979 } else { // Has arguments?
4980 // Loop through FunctionType's arguments and ensure they are specified
4983 FunctionType::param_iterator I = Ty->param_begin();
4984 FunctionType::param_iterator E = Ty->param_end();
4985 ParamList::iterator ArgI = yyvsp[-2].ParamList->begin(), ArgE = yyvsp[-2].ParamList->end();
4987 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4988 if (ArgI->Val->getType() != *I)
4989 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4990 (*I)->getDescription() + "'");
4991 Args.push_back(ArgI->Val);
4993 if (Ty->isVarArg()) {
4995 for (; ArgI != ArgE; ++ArgI)
4996 Args.push_back(ArgI->Val); // push the remaining varargs
4997 } else if (I != E || ArgI != ArgE)
4998 GEN_ERROR("Invalid number of parameters detected");
5000 // Create the call node
5001 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
5002 CI->setTailCall(yyvsp[-7].BoolVal);
5003 CI->setCallingConv(yyvsp[-6].UIntVal);
5005 delete yyvsp[-2].ParamList;
5006 delete yyvsp[-5].TypeVal;
5011 #line 3019 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5013 yyval.InstVal = yyvsp[0].InstVal;
5018 #line 3024 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5020 yyval.BoolVal = true;
5025 #line 3028 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5027 yyval.BoolVal = false;
5032 #line 3035 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5034 if (!UpRefs.empty())
5035 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5036 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5037 delete yyvsp[-1].TypeVal;
5042 #line 3042 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5044 if (!UpRefs.empty())
5045 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5046 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5048 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5049 delete yyvsp[-4].TypeVal;
5053 #line 3050 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5055 if (!UpRefs.empty())
5056 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5057 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5058 delete yyvsp[-1].TypeVal;
5063 #line 3057 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5065 if (!UpRefs.empty())
5066 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5067 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5069 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5070 delete yyvsp[-4].TypeVal;
5074 #line 3065 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5076 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5077 GEN_ERROR("Trying to free nonpointer type " +
5078 yyvsp[0].ValueVal->getType()->getDescription() + "");
5079 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5084 #line 3073 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5086 if (!UpRefs.empty())
5087 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5088 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5089 GEN_ERROR("Can't load from nonpointer type: " +
5090 (*yyvsp[-2].TypeVal)->getDescription());
5091 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5092 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5093 (*yyvsp[-2].TypeVal)->getDescription());
5094 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5096 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5097 delete yyvsp[-2].TypeVal;
5101 #line 3087 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5103 if (!UpRefs.empty())
5104 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5105 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5107 GEN_ERROR("Can't store to a nonpointer type: " +
5108 (*yyvsp[-2].TypeVal)->getDescription());
5109 const Type *ElTy = PT->getElementType();
5110 if (ElTy != yyvsp[-4].ValueVal->getType())
5111 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5112 "' into space of type '" + ElTy->getDescription() + "'");
5114 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5116 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5117 delete yyvsp[-2].TypeVal;
5121 #line 3104 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5123 if (!UpRefs.empty())
5124 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5125 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5126 GEN_ERROR("getelementptr insn requires pointer operand");
5128 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
5129 GEN_ERROR("Invalid getelementptr indices for type '" +
5130 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5131 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5133 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
5134 delete yyvsp[-2].TypeVal;
5135 delete yyvsp[0].ValueList;
5139 /* the action file gets copied in in place of this dollarsign */
5140 #line 543 "/usr/share/bison.simple"
5151 short *ssp1 = yyss - 1;
5152 fprintf (stderr, "state stack now");
5153 while (ssp1 != yyssp)
5154 fprintf (stderr, " %d", *++ssp1);
5155 fprintf (stderr, "\n");
5165 yylsp->first_line = yylloc.first_line;
5166 yylsp->first_column = yylloc.first_column;
5167 yylsp->last_line = (yylsp-1)->last_line;
5168 yylsp->last_column = (yylsp-1)->last_column;
5173 yylsp->last_line = (yylsp+yylen-1)->last_line;
5174 yylsp->last_column = (yylsp+yylen-1)->last_column;
5178 /* Now "shift" the result of the reduction.
5179 Determine what state that goes to,
5180 based on the state we popped back to
5181 and the rule number reduced by. */
5185 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5186 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5187 yystate = yytable[yystate];
5189 yystate = yydefgoto[yyn - YYNTBASE];
5193 yyerrlab: /* here on detecting error */
5196 /* If not already recovering from an error, report this error. */
5200 #ifdef YYERROR_VERBOSE
5201 yyn = yypact[yystate];
5203 if (yyn > YYFLAG && yyn < YYLAST)
5210 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5211 for (x = (yyn < 0 ? -yyn : 0);
5212 x < (sizeof(yytname) / sizeof(char *)); x++)
5213 if (yycheck[x + yyn] == x)
5214 size += strlen(yytname[x]) + 15, count++;
5215 msg = (char *) malloc(size + 15);
5218 strcpy(msg, "parse error");
5223 for (x = (yyn < 0 ? -yyn : 0);
5224 x < (sizeof(yytname) / sizeof(char *)); x++)
5225 if (yycheck[x + yyn] == x)
5227 strcat(msg, count == 0 ? ", expecting `" : " or `");
5228 strcat(msg, yytname[x]);
5237 yyerror ("parse error; also virtual memory exceeded");
5240 #endif /* YYERROR_VERBOSE */
5241 yyerror("parse error");
5245 yyerrlab1: /* here on error raised explicitly by an action */
5247 if (yyerrstatus == 3)
5249 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5251 /* return failure if at end of input */
5252 if (yychar == YYEOF)
5257 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5263 /* Else will try to reuse lookahead token
5264 after shifting the error token. */
5266 yyerrstatus = 3; /* Each real token shifted decrements this */
5270 yyerrdefault: /* current state does not do anything special for the error token. */
5273 /* This is wrong; only states that explicitly want error tokens
5274 should shift them. */
5275 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5276 if (yyn) goto yydefault;
5279 yyerrpop: /* pop the current state because it cannot handle the error token */
5281 if (yyssp == yyss) YYABORT;
5291 short *ssp1 = yyss - 1;
5292 fprintf (stderr, "Error: state stack now");
5293 while (ssp1 != yyssp)
5294 fprintf (stderr, " %d", *++ssp1);
5295 fprintf (stderr, "\n");
5301 yyn = yypact[yystate];
5306 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5325 fprintf(stderr, "Shifting error token, ");
5337 /* YYACCEPT comes here. */
5349 /* YYABORT comes here. */
5360 #line 3121 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
5363 // common code from the two 'RunVMAsmParser' functions
5364 static Module* RunParser(Module * M) {
5366 llvmAsmlineno = 1; // Reset the current line number...
5367 CurModule.CurrentModule = M;
5372 // Check to make sure the parser succeeded
5375 delete ParserResult;
5379 // Emit an error if there are any unresolved types left.
5380 if (!CurModule.LateResolveTypes.empty()) {
5381 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5382 if (DID.Type == ValID::LocalName) {
5383 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5385 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5388 delete ParserResult;
5392 // Emit an error if there are any unresolved values left.
5393 if (!CurModule.LateResolveValues.empty()) {
5394 Value *V = CurModule.LateResolveValues.back();
5395 std::map<Value*, std::pair<ValID, int> >::iterator I =
5396 CurModule.PlaceHolderInfo.find(V);
5398 if (I != CurModule.PlaceHolderInfo.end()) {
5399 ValID &DID = I->second.first;
5400 if (DID.Type == ValID::LocalName) {
5401 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5403 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5406 delete ParserResult;
5411 // Check to make sure that parsing produced a result
5415 // Reset ParserResult variable while saving its value for the result.
5416 Module *Result = ParserResult;
5422 void llvm::GenerateError(const std::string &message, int LineNo) {
5423 if (LineNo == -1) LineNo = llvmAsmlineno;
5424 // TODO: column number in exception
5426 TheParseError->setError(CurFilename, message, LineNo);
5430 int yyerror(const char *ErrorMsg) {
5432 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5433 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5434 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5435 if (yychar != YYEMPTY && yychar != 0)
5436 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5438 GenerateError(errMsg);