2 /* A Bison parser, made from /Users/clamb/Documents/llvm/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
71 #define SIDEEFFECT 314
74 #define FASTCC_TOK 317
75 #define COLDCC_TOK 318
76 #define X86_STDCALLCC_TOK 319
77 #define X86_FASTCALLCC_TOK 320
78 #define DATALAYOUT 321
84 #define UNREACHABLE 327
127 #define GETELEMENTPTR 370
143 #define EXTRACTELEMENT 386
144 #define INSERTELEMENT 387
145 #define SHUFFLEVECTOR 388
160 #define PROTECTED 403
162 #line 14 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
164 #include "ParserInternals.h"
165 #include "llvm/CallingConv.h"
166 #include "llvm/InlineAsm.h"
167 #include "llvm/Instructions.h"
168 #include "llvm/Module.h"
169 #include "llvm/ValueSymbolTable.h"
170 #include "llvm/AutoUpgrade.h"
171 #include "llvm/Support/GetElementPtrTypeIterator.h"
172 #include "llvm/Support/CommandLine.h"
173 #include "llvm/ADT/SmallVector.h"
174 #include "llvm/ADT/STLExtras.h"
175 #include "llvm/Support/MathExtras.h"
176 #include "llvm/Support/Streams.h"
182 // The following is a gross hack. In order to rid the libAsmParser library of
183 // exceptions, we have to have a way of getting the yyparse function to go into
184 // an error situation. So, whenever we want an error to occur, the GenerateError
185 // function (see bottom of file) sets TriggerError. Then, at the end of each
186 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
187 // (a goto) to put YACC in error state. Furthermore, several calls to
188 // GenerateError are made from inside productions and they must simulate the
189 // previous exception behavior by exiting the production immediately. We have
190 // replaced these with the GEN_ERROR macro which calls GeneratError and then
191 // immediately invokes YYERROR. This would be so much cleaner if it was a
192 // recursive descent parser.
193 static bool TriggerError = false;
194 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
195 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
197 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
198 int yylex(); // declaration" of xxx warnings.
200 using namespace llvm;
202 static Module *ParserResult;
204 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
205 // relating to upreferences in the input stream.
207 //#define DEBUG_UPREFS 1
209 #define UR_OUT(X) cerr << X
214 #define YYERROR_VERBOSE 1
216 static GlobalVariable *CurGV;
219 // This contains info used when building the body of a function. It is
220 // destroyed when the function is completed.
222 typedef std::vector<Value *> ValueList; // Numbered defs
225 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
227 static struct PerModuleInfo {
228 Module *CurrentModule;
229 ValueList Values; // Module level numbered definitions
230 ValueList LateResolveValues;
231 std::vector<PATypeHolder> Types;
232 std::map<ValID, PATypeHolder> LateResolveTypes;
234 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
235 /// how they were referenced and on which line of the input they came from so
236 /// that we can resolve them later and print error messages as appropriate.
237 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
239 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
240 // references to global values. Global values may be referenced before they
241 // are defined, and if so, the temporary object that they represent is held
242 // here. This is used for forward references of GlobalValues.
244 typedef std::map<std::pair<const PointerType *,
245 ValID>, GlobalValue*> GlobalRefsType;
246 GlobalRefsType GlobalRefs;
249 // If we could not resolve some functions at function compilation time
250 // (calls to functions before they are defined), resolve them now... Types
251 // are resolved when the constant pool has been completely parsed.
253 ResolveDefinitions(LateResolveValues);
257 // Check to make sure that all global value forward references have been
260 if (!GlobalRefs.empty()) {
261 std::string UndefinedReferences = "Unresolved global references exist:\n";
263 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
265 UndefinedReferences += " " + I->first.first->getDescription() + " " +
266 I->first.second.getName() + "\n";
268 GenerateError(UndefinedReferences);
272 // Look for intrinsic functions and CallInst that need to be upgraded
273 for (Module::iterator FI = CurrentModule->begin(),
274 FE = CurrentModule->end(); FI != FE; )
275 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
277 Values.clear(); // Clear out function local definitions
282 // GetForwardRefForGlobal - Check to see if there is a forward reference
283 // for this global. If so, remove it from the GlobalRefs map and return it.
284 // If not, just return null.
285 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
286 // Check to see if there is a forward reference to this global variable...
287 // if there is, eliminate it and patch the reference to use the new def'n.
288 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
289 GlobalValue *Ret = 0;
290 if (I != GlobalRefs.end()) {
297 bool TypeIsUnresolved(PATypeHolder* PATy) {
298 // If it isn't abstract, its resolved
299 const Type* Ty = PATy->get();
300 if (!Ty->isAbstract())
302 // Traverse the type looking for abstract types. If it isn't abstract then
303 // we don't need to traverse that leg of the type.
304 std::vector<const Type*> WorkList, SeenList;
305 WorkList.push_back(Ty);
306 while (!WorkList.empty()) {
307 const Type* Ty = WorkList.back();
308 SeenList.push_back(Ty);
310 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
311 // Check to see if this is an unresolved type
312 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
313 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
314 for ( ; I != E; ++I) {
315 if (I->second.get() == OpTy)
318 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
319 const Type* TheTy = SeqTy->getElementType();
320 if (TheTy->isAbstract() && TheTy != Ty) {
321 std::vector<const Type*>::iterator I = SeenList.begin(),
327 WorkList.push_back(TheTy);
329 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
330 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
331 const Type* TheTy = StrTy->getElementType(i);
332 if (TheTy->isAbstract() && TheTy != Ty) {
333 std::vector<const Type*>::iterator I = SeenList.begin(),
339 WorkList.push_back(TheTy);
348 static struct PerFunctionInfo {
349 Function *CurrentFunction; // Pointer to current function being created
351 ValueList Values; // Keep track of #'d definitions
353 ValueList LateResolveValues;
354 bool isDeclare; // Is this function a forward declararation?
355 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
356 GlobalValue::VisibilityTypes Visibility;
358 /// BBForwardRefs - When we see forward references to basic blocks, keep
359 /// track of them here.
360 std::map<ValID, BasicBlock*> BBForwardRefs;
362 inline PerFunctionInfo() {
365 Linkage = GlobalValue::ExternalLinkage;
366 Visibility = GlobalValue::DefaultVisibility;
369 inline void FunctionStart(Function *M) {
374 void FunctionDone() {
375 // Any forward referenced blocks left?
376 if (!BBForwardRefs.empty()) {
377 GenerateError("Undefined reference to label " +
378 BBForwardRefs.begin()->second->getName());
382 // Resolve all forward references now.
383 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
385 Values.clear(); // Clear out function local definitions
386 BBForwardRefs.clear();
389 Linkage = GlobalValue::ExternalLinkage;
390 Visibility = GlobalValue::DefaultVisibility;
392 } CurFun; // Info for the current function...
394 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
397 //===----------------------------------------------------------------------===//
398 // Code to handle definitions of all the types
399 //===----------------------------------------------------------------------===//
401 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
402 // Things that have names or are void typed don't get slot numbers
403 if (V->hasName() || (V->getType() == Type::VoidTy))
406 // In the case of function values, we have to allow for the forward reference
407 // of basic blocks, which are included in the numbering. Consequently, we keep
408 // track of the next insertion location with NextValNum. When a BB gets
409 // inserted, it could change the size of the CurFun.Values vector.
410 if (&ValueTab == &CurFun.Values) {
411 if (ValueTab.size() <= CurFun.NextValNum)
412 ValueTab.resize(CurFun.NextValNum+1);
413 ValueTab[CurFun.NextValNum++] = V;
416 // For all other lists, its okay to just tack it on the back of the vector.
417 ValueTab.push_back(V);
420 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
422 case ValID::LocalID: // Is it a numbered definition?
423 // Module constants occupy the lowest numbered slots...
424 if (D.Num < CurModule.Types.size())
425 return CurModule.Types[D.Num];
427 case ValID::LocalName: // Is it a named definition?
428 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
429 D.destroy(); // Free old strdup'd memory...
434 GenerateError("Internal parser error: Invalid symbol type reference");
438 // If we reached here, we referenced either a symbol that we don't know about
439 // or an id number that hasn't been read yet. We may be referencing something
440 // forward, so just create an entry to be resolved later and get to it...
442 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
445 if (inFunctionScope()) {
446 if (D.Type == ValID::LocalName) {
447 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
450 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
455 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
456 if (I != CurModule.LateResolveTypes.end())
459 Type *Typ = OpaqueType::get();
460 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
464 // getExistingVal - Look up the value specified by the provided type and
465 // the provided ValID. If the value exists and has already been defined, return
466 // it. Otherwise return null.
468 static Value *getExistingVal(const Type *Ty, const ValID &D) {
469 if (isa<FunctionType>(Ty)) {
470 GenerateError("Functions are not values and "
471 "must be referenced as pointers");
476 case ValID::LocalID: { // Is it a numbered definition?
477 // Check that the number is within bounds.
478 if (D.Num >= CurFun.Values.size())
480 Value *Result = CurFun.Values[D.Num];
481 if (Ty != Result->getType()) {
482 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
483 Result->getType()->getDescription() + "' does not match "
484 "expected type, '" + Ty->getDescription() + "'");
489 case ValID::GlobalID: { // Is it a numbered definition?
490 if (D.Num >= CurModule.Values.size())
492 Value *Result = CurModule.Values[D.Num];
493 if (Ty != Result->getType()) {
494 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
495 Result->getType()->getDescription() + "' does not match "
496 "expected type, '" + Ty->getDescription() + "'");
502 case ValID::LocalName: { // Is it a named definition?
503 if (!inFunctionScope())
505 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
506 Value *N = SymTab.lookup(D.getName());
509 if (N->getType() != Ty)
512 D.destroy(); // Free old strdup'd memory...
515 case ValID::GlobalName: { // Is it a named definition?
516 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
517 Value *N = SymTab.lookup(D.getName());
520 if (N->getType() != Ty)
523 D.destroy(); // Free old strdup'd memory...
527 // Check to make sure that "Ty" is an integral type, and that our
528 // value will fit into the specified type...
529 case ValID::ConstSIntVal: // Is it a constant pool reference??
530 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
531 GenerateError("Signed integral constant '" +
532 itostr(D.ConstPool64) + "' is invalid for type '" +
533 Ty->getDescription() + "'");
536 return ConstantInt::get(Ty, D.ConstPool64, true);
538 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
539 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
540 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
541 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
542 "' is invalid or out of range");
544 } else { // This is really a signed reference. Transmogrify.
545 return ConstantInt::get(Ty, D.ConstPool64, true);
548 return ConstantInt::get(Ty, D.UConstPool64);
551 case ValID::ConstFPVal: // Is it a floating point const pool reference?
552 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
553 GenerateError("FP constant invalid for type");
556 // Lexer has no type info, so builds all float and double FP constants
557 // as double. Fix this here. Long double does not need this.
558 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
560 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
561 return ConstantFP::get(Ty, *D.ConstPoolFP);
563 case ValID::ConstNullVal: // Is it a null value?
564 if (!isa<PointerType>(Ty)) {
565 GenerateError("Cannot create a a non pointer null");
568 return ConstantPointerNull::get(cast<PointerType>(Ty));
570 case ValID::ConstUndefVal: // Is it an undef value?
571 return UndefValue::get(Ty);
573 case ValID::ConstZeroVal: // Is it a zero value?
574 return Constant::getNullValue(Ty);
576 case ValID::ConstantVal: // Fully resolved constant?
577 if (D.ConstantValue->getType() != Ty) {
578 GenerateError("Constant expression type different from required type");
581 return D.ConstantValue;
583 case ValID::InlineAsmVal: { // Inline asm expression
584 const PointerType *PTy = dyn_cast<PointerType>(Ty);
585 const FunctionType *FTy =
586 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
587 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
588 GenerateError("Invalid type for asm constraint string");
591 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
592 D.IAD->HasSideEffects);
593 D.destroy(); // Free InlineAsmDescriptor.
597 assert(0 && "Unhandled case!");
601 assert(0 && "Unhandled case!");
605 // getVal - This function is identical to getExistingVal, except that if a
606 // value is not already defined, it "improvises" by creating a placeholder var
607 // that looks and acts just like the requested variable. When the value is
608 // defined later, all uses of the placeholder variable are replaced with the
611 static Value *getVal(const Type *Ty, const ValID &ID) {
612 if (Ty == Type::LabelTy) {
613 GenerateError("Cannot use a basic block here");
617 // See if the value has already been defined.
618 Value *V = getExistingVal(Ty, ID);
620 if (TriggerError) return 0;
622 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
623 GenerateError("Invalid use of a composite type");
627 // If we reached here, we referenced either a symbol that we don't know about
628 // or an id number that hasn't been read yet. We may be referencing something
629 // forward, so just create an entry to be resolved later and get to it...
632 case ValID::GlobalName:
633 case ValID::GlobalID: {
634 const PointerType *PTy = dyn_cast<PointerType>(Ty);
636 GenerateError("Invalid type for reference to global" );
639 const Type* ElTy = PTy->getElementType();
640 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
641 V = new Function(FTy, GlobalValue::ExternalLinkage);
643 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
644 (Module*)0, false, PTy->getAddressSpace());
648 V = new Argument(Ty);
651 // Remember where this forward reference came from. FIXME, shouldn't we try
652 // to recycle these things??
653 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
656 if (inFunctionScope())
657 InsertValue(V, CurFun.LateResolveValues);
659 InsertValue(V, CurModule.LateResolveValues);
663 /// defineBBVal - This is a definition of a new basic block with the specified
664 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
665 static BasicBlock *defineBBVal(const ValID &ID) {
666 assert(inFunctionScope() && "Can't get basic block at global scope!");
670 // First, see if this was forward referenced
672 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
673 if (BBI != CurFun.BBForwardRefs.end()) {
675 // The forward declaration could have been inserted anywhere in the
676 // function: insert it into the correct place now.
677 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
678 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
680 // We're about to erase the entry, save the key so we can clean it up.
681 ValID Tmp = BBI->first;
683 // Erase the forward ref from the map as its no longer "forward"
684 CurFun.BBForwardRefs.erase(ID);
686 // The key has been removed from the map but so we don't want to leave
687 // strdup'd memory around so destroy it too.
690 // If its a numbered definition, bump the number and set the BB value.
691 if (ID.Type == ValID::LocalID) {
692 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
700 // We haven't seen this BB before and its first mention is a definition.
701 // Just create it and return it.
702 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
703 BB = new BasicBlock(Name, CurFun.CurrentFunction);
704 if (ID.Type == ValID::LocalID) {
705 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
709 ID.destroy(); // Free strdup'd memory
713 /// getBBVal - get an existing BB value or create a forward reference for it.
715 static BasicBlock *getBBVal(const ValID &ID) {
716 assert(inFunctionScope() && "Can't get basic block at global scope!");
720 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
721 if (BBI != CurFun.BBForwardRefs.end()) {
723 } if (ID.Type == ValID::LocalName) {
724 std::string Name = ID.getName();
725 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
727 if (N->getType()->getTypeID() == Type::LabelTyID)
728 BB = cast<BasicBlock>(N);
730 GenerateError("Reference to label '" + Name + "' is actually of type '"+
731 N->getType()->getDescription() + "'");
732 } else if (ID.Type == ValID::LocalID) {
733 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
734 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
735 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
737 GenerateError("Reference to label '%" + utostr(ID.Num) +
738 "' is actually of type '"+
739 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
742 GenerateError("Illegal label reference " + ID.getName());
746 // If its already been defined, return it now.
748 ID.destroy(); // Free strdup'd memory.
752 // Otherwise, this block has not been seen before, create it.
754 if (ID.Type == ValID::LocalName)
756 BB = new BasicBlock(Name, CurFun.CurrentFunction);
758 // Insert it in the forward refs map.
759 CurFun.BBForwardRefs[ID] = BB;
765 //===----------------------------------------------------------------------===//
766 // Code to handle forward references in instructions
767 //===----------------------------------------------------------------------===//
769 // This code handles the late binding needed with statements that reference
770 // values not defined yet... for example, a forward branch, or the PHI node for
773 // This keeps a table (CurFun.LateResolveValues) of all such forward references
774 // and back patchs after we are done.
777 // ResolveDefinitions - If we could not resolve some defs at parsing
778 // time (forward branches, phi functions for loops, etc...) resolve the
782 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
783 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
784 while (!LateResolvers.empty()) {
785 Value *V = LateResolvers.back();
786 LateResolvers.pop_back();
788 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
789 CurModule.PlaceHolderInfo.find(V);
790 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
792 ValID &DID = PHI->second.first;
794 Value *TheRealValue = getExistingVal(V->getType(), DID);
798 V->replaceAllUsesWith(TheRealValue);
800 CurModule.PlaceHolderInfo.erase(PHI);
801 } else if (FutureLateResolvers) {
802 // Functions have their unresolved items forwarded to the module late
804 InsertValue(V, *FutureLateResolvers);
806 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
807 GenerateError("Reference to an invalid definition: '" +DID.getName()+
808 "' of type '" + V->getType()->getDescription() + "'",
812 GenerateError("Reference to an invalid definition: #" +
813 itostr(DID.Num) + " of type '" +
814 V->getType()->getDescription() + "'",
820 LateResolvers.clear();
823 // ResolveTypeTo - A brand new type was just declared. This means that (if
824 // name is not null) things referencing Name can be resolved. Otherwise, things
825 // refering to the number can be resolved. Do this now.
827 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
830 D = ValID::createLocalName(*Name);
832 D = ValID::createLocalID(CurModule.Types.size());
834 std::map<ValID, PATypeHolder>::iterator I =
835 CurModule.LateResolveTypes.find(D);
836 if (I != CurModule.LateResolveTypes.end()) {
837 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
838 CurModule.LateResolveTypes.erase(I);
842 // setValueName - Set the specified value to the name given. The name may be
843 // null potentially, in which case this is a noop. The string passed in is
844 // assumed to be a malloc'd string buffer, and is free'd by this function.
846 static void setValueName(Value *V, std::string *NameStr) {
847 if (!NameStr) return;
848 std::string Name(*NameStr); // Copy string
849 delete NameStr; // Free old string
851 if (V->getType() == Type::VoidTy) {
852 GenerateError("Can't assign name '" + Name+"' to value with void type");
856 assert(inFunctionScope() && "Must be in function scope!");
857 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
858 if (ST.lookup(Name)) {
859 GenerateError("Redefinition of value '" + Name + "' of type '" +
860 V->getType()->getDescription() + "'");
868 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
869 /// this is a declaration, otherwise it is a definition.
870 static GlobalVariable *
871 ParseGlobalVariable(std::string *NameStr,
872 GlobalValue::LinkageTypes Linkage,
873 GlobalValue::VisibilityTypes Visibility,
874 bool isConstantGlobal, const Type *Ty,
875 Constant *Initializer, bool IsThreadLocal,
876 unsigned AddressSpace = 0) {
877 if (isa<FunctionType>(Ty)) {
878 GenerateError("Cannot declare global vars of function type");
882 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
886 Name = *NameStr; // Copy string
887 delete NameStr; // Free old string
890 // See if this global value was forward referenced. If so, recycle the
894 ID = ValID::createGlobalName(Name);
896 ID = ValID::createGlobalID(CurModule.Values.size());
899 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
900 // Move the global to the end of the list, from whereever it was
901 // previously inserted.
902 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
903 CurModule.CurrentModule->getGlobalList().remove(GV);
904 CurModule.CurrentModule->getGlobalList().push_back(GV);
905 GV->setInitializer(Initializer);
906 GV->setLinkage(Linkage);
907 GV->setVisibility(Visibility);
908 GV->setConstant(isConstantGlobal);
909 GV->setThreadLocal(IsThreadLocal);
910 InsertValue(GV, CurModule.Values);
914 // If this global has a name
916 // if the global we're parsing has an initializer (is a definition) and
917 // has external linkage.
918 if (Initializer && Linkage != GlobalValue::InternalLinkage)
919 // If there is already a global with external linkage with this name
920 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
921 // If we allow this GVar to get created, it will be renamed in the
922 // symbol table because it conflicts with an existing GVar. We can't
923 // allow redefinition of GVars whose linking indicates that their name
924 // must stay the same. Issue the error.
925 GenerateError("Redefinition of global variable named '" + Name +
926 "' of type '" + Ty->getDescription() + "'");
931 // Otherwise there is no existing GV to use, create one now.
933 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
934 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
935 GV->setVisibility(Visibility);
936 InsertValue(GV, CurModule.Values);
940 // setTypeName - Set the specified type to the name given. The name may be
941 // null potentially, in which case this is a noop. The string passed in is
942 // assumed to be a malloc'd string buffer, and is freed by this function.
944 // This function returns true if the type has already been defined, but is
945 // allowed to be redefined in the specified context. If the name is a new name
946 // for the type plane, it is inserted and false is returned.
947 static bool setTypeName(const Type *T, std::string *NameStr) {
948 assert(!inFunctionScope() && "Can't give types function-local names!");
949 if (NameStr == 0) return false;
951 std::string Name(*NameStr); // Copy string
952 delete NameStr; // Free old string
954 // We don't allow assigning names to void type
955 if (T == Type::VoidTy) {
956 GenerateError("Can't assign name '" + Name + "' to the void type");
960 // Set the type name, checking for conflicts as we do so.
961 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
963 if (AlreadyExists) { // Inserting a name that is already defined???
964 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
965 assert(Existing && "Conflict but no matching type?!");
967 // There is only one case where this is allowed: when we are refining an
968 // opaque type. In this case, Existing will be an opaque type.
969 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
970 // We ARE replacing an opaque type!
971 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
975 // Otherwise, this is an attempt to redefine a type. That's okay if
976 // the redefinition is identical to the original. This will be so if
977 // Existing and T point to the same Type object. In this one case we
978 // allow the equivalent redefinition.
979 if (Existing == T) return true; // Yes, it's equal.
981 // Any other kind of (non-equivalent) redefinition is an error.
982 GenerateError("Redefinition of type named '" + Name + "' of type '" +
983 T->getDescription() + "'");
989 //===----------------------------------------------------------------------===//
990 // Code for handling upreferences in type names...
993 // TypeContains - Returns true if Ty directly contains E in it.
995 static bool TypeContains(const Type *Ty, const Type *E) {
996 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
997 E) != Ty->subtype_end();
1001 struct UpRefRecord {
1002 // NestingLevel - The number of nesting levels that need to be popped before
1003 // this type is resolved.
1004 unsigned NestingLevel;
1006 // LastContainedTy - This is the type at the current binding level for the
1007 // type. Every time we reduce the nesting level, this gets updated.
1008 const Type *LastContainedTy;
1010 // UpRefTy - This is the actual opaque type that the upreference is
1011 // represented with.
1012 OpaqueType *UpRefTy;
1014 UpRefRecord(unsigned NL, OpaqueType *URTy)
1015 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1019 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1020 static std::vector<UpRefRecord> UpRefs;
1022 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1023 /// called. It loops through the UpRefs vector, which is a list of the
1024 /// currently active types. For each type, if the up reference is contained in
1025 /// the newly completed type, we decrement the level count. When the level
1026 /// count reaches zero, the upreferenced type is the type that is passed in:
1027 /// thus we can complete the cycle.
1029 static PATypeHolder HandleUpRefs(const Type *ty) {
1030 // If Ty isn't abstract, or if there are no up-references in it, then there is
1031 // nothing to resolve here.
1032 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1034 PATypeHolder Ty(ty);
1035 UR_OUT("Type '" << Ty->getDescription() <<
1036 "' newly formed. Resolving upreferences.\n" <<
1037 UpRefs.size() << " upreferences active!\n");
1039 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1040 // to zero), we resolve them all together before we resolve them to Ty. At
1041 // the end of the loop, if there is anything to resolve to Ty, it will be in
1043 OpaqueType *TypeToResolve = 0;
1045 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1046 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1047 << UpRefs[i].second->getDescription() << ") = "
1048 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1049 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1050 // Decrement level of upreference
1051 unsigned Level = --UpRefs[i].NestingLevel;
1052 UpRefs[i].LastContainedTy = Ty;
1053 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1054 if (Level == 0) { // Upreference should be resolved!
1055 if (!TypeToResolve) {
1056 TypeToResolve = UpRefs[i].UpRefTy;
1058 UR_OUT(" * Resolving upreference for "
1059 << UpRefs[i].second->getDescription() << "\n";
1060 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1061 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1062 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1063 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1065 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1066 --i; // Do not skip the next element...
1071 if (TypeToResolve) {
1072 UR_OUT(" * Resolving upreference for "
1073 << UpRefs[i].second->getDescription() << "\n";
1074 std::string OldName = TypeToResolve->getDescription());
1075 TypeToResolve->refineAbstractTypeTo(Ty);
1081 //===----------------------------------------------------------------------===//
1082 // RunVMAsmParser - Define an interface to this parser
1083 //===----------------------------------------------------------------------===//
1085 static Module* RunParser(Module * M);
1087 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1089 Module *M = RunParser(new Module(LLLgetFilename()));
1095 #line 947 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
1097 llvm::Module *ModuleVal;
1098 llvm::Function *FunctionVal;
1099 llvm::BasicBlock *BasicBlockVal;
1100 llvm::TerminatorInst *TermInstVal;
1101 llvm::Instruction *InstVal;
1102 llvm::Constant *ConstVal;
1104 const llvm::Type *PrimType;
1105 std::list<llvm::PATypeHolder> *TypeList;
1106 llvm::PATypeHolder *TypeVal;
1107 llvm::Value *ValueVal;
1108 std::vector<llvm::Value*> *ValueList;
1109 llvm::ArgListType *ArgList;
1110 llvm::TypeWithAttrs TypeWithAttrs;
1111 llvm::TypeWithAttrsList *TypeWithAttrsList;
1112 llvm::ParamList *ParamList;
1114 // Represent the RHS of PHI node
1115 std::list<std::pair<llvm::Value*,
1116 llvm::BasicBlock*> > *PHIList;
1117 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1118 std::vector<llvm::Constant*> *ConstVector;
1120 llvm::GlobalValue::LinkageTypes Linkage;
1121 llvm::GlobalValue::VisibilityTypes Visibility;
1122 uint16_t ParamAttrs;
1123 llvm::APInt *APIntVal;
1128 llvm::APFloat *FPVal;
1131 std::string *StrVal; // This memory must be deleted
1132 llvm::ValID ValIDVal;
1134 llvm::Instruction::BinaryOps BinaryOpVal;
1135 llvm::Instruction::TermOps TermOpVal;
1136 llvm::Instruction::MemoryOps MemOpVal;
1137 llvm::Instruction::CastOps CastOpVal;
1138 llvm::Instruction::OtherOps OtherOpVal;
1139 llvm::ICmpInst::Predicate IPredicate;
1140 llvm::FCmpInst::Predicate FPredicate;
1153 #define YYFLAG -32768
1154 #define YYNTBASE 164
1156 #define YYTRANSLATE(x) ((unsigned)(x) <= 403 ? yytranslate[x] : 247)
1158 static const short yytranslate[] = { 0,
1159 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1160 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1161 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1162 2, 2, 2, 2, 2, 2, 2, 2, 2, 153,
1163 154, 152, 2, 151, 2, 2, 2, 2, 2, 2,
1164 2, 2, 2, 2, 2, 2, 2, 2, 2, 159,
1165 150, 160, 2, 2, 2, 2, 2, 2, 2, 2,
1166 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1167 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1168 156, 155, 158, 2, 2, 2, 2, 2, 163, 2,
1169 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1170 2, 2, 2, 2, 2, 2, 2, 2, 2, 157,
1171 2, 2, 161, 2, 162, 2, 2, 2, 2, 2,
1172 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1173 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1174 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1185 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1186 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1187 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1188 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1189 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1190 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1191 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1192 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1193 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1194 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1195 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1196 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1197 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1198 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
1203 static const short yyprhs[] = { 0,
1204 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1205 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1206 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1207 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1208 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1209 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1210 120, 122, 124, 126, 127, 130, 131, 133, 135, 137,
1211 138, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1212 158, 160, 162, 164, 165, 167, 169, 170, 172, 174,
1213 176, 178, 179, 181, 183, 184, 186, 188, 190, 192,
1214 194, 197, 199, 201, 203, 205, 207, 209, 211, 213,
1215 215, 216, 219, 221, 223, 225, 227, 229, 231, 232,
1216 235, 236, 239, 240, 243, 244, 248, 251, 252, 254,
1217 255, 259, 261, 264, 266, 268, 270, 272, 274, 276,
1218 278, 280, 282, 285, 292, 294, 297, 303, 309, 315,
1219 321, 325, 328, 334, 339, 342, 344, 346, 348, 352,
1220 354, 358, 360, 361, 363, 367, 372, 376, 380, 385,
1221 390, 394, 401, 407, 410, 413, 416, 419, 422, 425,
1222 428, 431, 434, 437, 440, 443, 450, 456, 465, 472,
1223 479, 487, 495, 502, 511, 520, 524, 526, 528, 530,
1224 532, 533, 536, 543, 545, 546, 548, 551, 552, 556,
1225 557, 561, 565, 569, 573, 574, 582, 583, 595, 596,
1226 605, 606, 615, 621, 624, 628, 630, 634, 638, 642,
1227 646, 648, 649, 655, 659, 661, 665, 667, 668, 679,
1228 681, 683, 688, 690, 692, 695, 699, 700, 702, 704,
1229 706, 708, 710, 712, 714, 716, 718, 722, 724, 730,
1230 732, 734, 736, 738, 740, 742, 745, 748, 751, 755,
1231 758, 759, 761, 764, 767, 771, 781, 791, 800, 815,
1232 817, 819, 826, 832, 835, 842, 850, 855, 860, 867,
1233 874, 875, 876, 880, 883, 885, 891, 897, 904, 911,
1234 916, 923, 928, 933, 940, 947, 950, 959, 961, 963,
1235 964, 968, 975, 979, 986, 989, 995, 1003
1238 static const short yyrhs[] = { 74,
1239 0, 75, 0, 76, 0, 77, 0, 78, 0, 79,
1240 0, 80, 0, 81, 0, 82, 0, 86, 0, 87,
1241 0, 88, 0, 83, 0, 84, 0, 85, 0, 117,
1242 0, 118, 0, 119, 0, 120, 0, 121, 0, 122,
1243 0, 123, 0, 124, 0, 125, 0, 126, 0, 127,
1244 0, 128, 0, 91, 0, 92, 0, 93, 0, 94,
1245 0, 95, 0, 96, 0, 97, 0, 98, 0, 99,
1246 0, 100, 0, 101, 0, 102, 0, 103, 0, 104,
1247 0, 105, 0, 106, 0, 107, 0, 108, 0, 109,
1248 0, 110, 0, 97, 0, 98, 0, 99, 0, 100,
1249 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1250 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1251 0, 24, 0, 171, 0, 0, 171, 150, 0, 0,
1252 20, 0, 23, 0, 176, 0, 0, 174, 150, 0,
1253 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1254 46, 0, 48, 0, 50, 0, 0, 147, 0, 148,
1255 0, 149, 0, 0, 46, 0, 48, 0, 0, 42,
1256 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1257 42, 0, 0, 62, 0, 63, 0, 64, 0, 65,
1258 0, 66, 0, 61, 4, 0, 136, 0, 118, 0,
1259 135, 0, 119, 0, 138, 0, 139, 0, 141, 0,
1260 142, 0, 143, 0, 0, 185, 184, 0, 137, 0,
1261 140, 0, 136, 0, 135, 0, 144, 0, 145, 0,
1262 0, 187, 186, 0, 0, 146, 22, 0, 0, 53,
1263 4, 0, 0, 151, 53, 4, 0, 34, 22, 0,
1264 0, 191, 0, 0, 151, 194, 193, 0, 191, 0,
1265 53, 4, 0, 11, 0, 12, 0, 13, 0, 16,
1266 0, 15, 0, 14, 0, 17, 0, 49, 0, 195,
1267 0, 196, 152, 0, 196, 54, 153, 4, 154, 152,
1268 0, 231, 0, 155, 4, 0, 196, 153, 200, 154,
1269 187, 0, 10, 153, 200, 154, 187, 0, 156, 4,
1270 157, 196, 158, 0, 159, 4, 157, 196, 160, 0,
1271 161, 201, 162, 0, 161, 162, 0, 159, 161, 201,
1272 162, 160, 0, 159, 161, 162, 160, 0, 196, 185,
1273 0, 196, 0, 10, 0, 197, 0, 199, 151, 197,
1274 0, 199, 0, 199, 151, 39, 0, 39, 0, 0,
1275 196, 0, 201, 151, 196, 0, 196, 156, 204, 158,
1276 0, 196, 156, 158, 0, 196, 163, 22, 0, 196,
1277 159, 204, 160, 0, 196, 161, 204, 162, 0, 196,
1278 161, 162, 0, 196, 159, 161, 204, 162, 160, 0,
1279 196, 159, 161, 162, 160, 0, 196, 40, 0, 196,
1280 41, 0, 196, 231, 0, 196, 203, 0, 196, 25,
1281 0, 169, 3, 0, 169, 5, 0, 169, 4, 0,
1282 169, 6, 0, 11, 26, 0, 11, 27, 0, 170,
1283 9, 0, 166, 153, 202, 38, 196, 154, 0, 116,
1284 153, 202, 242, 154, 0, 130, 153, 202, 151, 202,
1285 151, 202, 154, 0, 164, 153, 202, 151, 202, 154,
1286 0, 165, 153, 202, 151, 202, 154, 0, 89, 167,
1287 153, 202, 151, 202, 154, 0, 90, 168, 153, 202,
1288 151, 202, 154, 0, 132, 153, 202, 151, 202, 154,
1289 0, 133, 153, 202, 151, 202, 151, 202, 154, 0,
1290 134, 153, 202, 151, 202, 151, 202, 154, 0, 204,
1291 151, 202, 0, 202, 0, 32, 0, 33, 0, 37,
1292 0, 0, 198, 231, 0, 122, 153, 207, 38, 196,
1293 154, 0, 209, 0, 0, 210, 0, 209, 210, 0,
1294 0, 31, 211, 227, 0, 0, 30, 212, 228, 0,
1295 59, 58, 217, 0, 173, 18, 196, 0, 173, 18,
1296 10, 0, 0, 175, 179, 206, 205, 202, 213, 193,
1297 0, 0, 175, 179, 206, 205, 202, 54, 153, 4,
1298 154, 214, 193, 0, 0, 175, 177, 179, 206, 205,
1299 202, 215, 193, 0, 0, 175, 178, 179, 206, 205,
1300 196, 216, 193, 0, 175, 179, 35, 182, 207, 0,
1301 51, 218, 0, 55, 150, 219, 0, 22, 0, 52,
1302 150, 22, 0, 67, 150, 22, 0, 156, 220, 158,
1303 0, 220, 151, 22, 0, 22, 0, 0, 221, 151,
1304 196, 185, 172, 0, 196, 185, 172, 0, 221, 0,
1305 221, 151, 39, 0, 39, 0, 0, 183, 198, 174,
1306 153, 222, 154, 187, 192, 189, 188, 0, 28, 0,
1307 161, 0, 181, 179, 223, 224, 0, 29, 0, 162,
1308 0, 234, 226, 0, 180, 179, 223, 0, 0, 60,
1309 0, 3, 0, 4, 0, 9, 0, 26, 0, 27,
1310 0, 40, 0, 41, 0, 25, 0, 159, 204, 160,
1311 0, 203, 0, 58, 229, 22, 151, 22, 0, 7,
1312 0, 8, 0, 171, 0, 174, 0, 231, 0, 230,
1313 0, 196, 232, 0, 234, 235, 0, 225, 235, 0,
1314 236, 173, 237, 0, 236, 239, 0, 0, 21, 0,
1315 68, 233, 0, 68, 10, 0, 69, 17, 232, 0,
1316 69, 11, 232, 151, 17, 232, 151, 17, 232, 0,
1317 70, 169, 232, 151, 17, 232, 156, 238, 158, 0,
1318 70, 169, 232, 151, 17, 232, 156, 158, 0, 71,
1319 183, 198, 232, 153, 241, 154, 187, 38, 17, 232,
1320 72, 17, 232, 0, 72, 0, 73, 0, 238, 169,
1321 230, 151, 17, 232, 0, 169, 230, 151, 17, 232,
1322 0, 173, 244, 0, 196, 156, 232, 151, 232, 158,
1323 0, 240, 151, 156, 232, 151, 232, 158, 0, 196,
1324 185, 232, 185, 0, 17, 185, 232, 185, 0, 241,
1325 151, 196, 185, 232, 185, 0, 241, 151, 17, 185,
1326 232, 185, 0, 0, 0, 242, 151, 233, 0, 57,
1327 56, 0, 56, 0, 164, 196, 232, 151, 232, 0,
1328 165, 196, 232, 151, 232, 0, 89, 167, 196, 232,
1329 151, 232, 0, 90, 168, 196, 232, 151, 232, 0,
1330 166, 233, 38, 196, 0, 130, 233, 151, 233, 151,
1331 233, 0, 131, 233, 151, 196, 0, 132, 233, 151,
1332 233, 0, 133, 233, 151, 233, 151, 233, 0, 134,
1333 233, 151, 233, 151, 233, 0, 129, 240, 0, 243,
1334 183, 198, 232, 153, 241, 154, 187, 0, 246, 0,
1335 36, 0, 0, 111, 196, 190, 0, 111, 196, 151,
1336 11, 232, 190, 0, 112, 196, 190, 0, 112, 196,
1337 151, 11, 232, 190, 0, 113, 233, 0, 245, 114,
1338 196, 232, 190, 0, 245, 115, 233, 151, 196, 232,
1339 190, 0, 116, 196, 232, 242, 0
1345 static const short yyrline[] = { 0,
1346 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1108,
1347 1108, 1108, 1108, 1108, 1108, 1109, 1109, 1109, 1109, 1109,
1348 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1113, 1113, 1114,
1349 1114, 1115, 1115, 1116, 1116, 1117, 1117, 1121, 1121, 1122,
1350 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1127,
1351 1127, 1128, 1129, 1134, 1135, 1135, 1135, 1135, 1135, 1137,
1352 1137, 1137, 1138, 1138, 1142, 1146, 1151, 1151, 1153, 1154,
1353 1159, 1165, 1166, 1167, 1168, 1169, 1173, 1174, 1175, 1179,
1354 1180, 1181, 1182, 1186, 1187, 1188, 1192, 1193, 1194, 1195,
1355 1196, 1200, 1201, 1202, 1205, 1205, 1206, 1207, 1208, 1209,
1356 1210, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226,
1357 1229, 1230, 1235, 1236, 1237, 1238, 1239, 1240, 1243, 1244,
1358 1249, 1250, 1257, 1257, 1264, 1264, 1274, 1282, 1282, 1288,
1359 1288, 1290, 1295, 1308, 1308, 1308, 1308, 1308, 1308, 1308,
1360 1311, 1315, 1319, 1326, 1333, 1338, 1346, 1376, 1401, 1406,
1361 1416, 1426, 1430, 1440, 1447, 1456, 1463, 1468, 1473, 1480,
1362 1481, 1488, 1495, 1503, 1509, 1521, 1549, 1565, 1592, 1620,
1363 1646, 1666, 1692, 1712, 1724, 1731, 1797, 1807, 1817, 1823,
1364 1833, 1839, 1849, 1854, 1859, 1872, 1884, 1906, 1914, 1920,
1365 1931, 1936, 1941, 1947, 1953, 1962, 1966, 1974, 1974, 1977,
1366 1977, 1980, 1992, 2013, 2018, 2026, 2027, 2031, 2031, 2035,
1367 2035, 2038, 2041, 2065, 2076, 2083, 2086, 2094, 2097, 2103,
1368 2106, 2113, 2117, 2157, 2160, 2166, 2176, 2180, 2185, 2187,
1369 2192, 2197, 2206, 2216, 2227, 2231, 2240, 2249, 2254, 2388,
1370 2388, 2390, 2399, 2399, 2401, 2406, 2418, 2422, 2427, 2431,
1371 2435, 2439, 2443, 2447, 2451, 2455, 2459, 2484, 2488, 2498,
1372 2502, 2506, 2511, 2518, 2518, 2524, 2533, 2537, 2546, 2555,
1373 2564, 2568, 2575, 2579, 2583, 2588, 2598, 2617, 2626, 2710,
1374 2714, 2721, 2732, 2745, 2755, 2766, 2776, 2787, 2795, 2805,
1375 2812, 2815, 2816, 2823, 2827, 2832, 2848, 2865, 2879, 2893,
1376 2905, 2913, 2920, 2926, 2932, 2938, 2953, 3044, 3049, 3053,
1377 3060, 3067, 3075, 3082, 3090, 3098, 3112, 3129
1382 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1384 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1385 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1386 "VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1387 "LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1388 "ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1389 "GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1390 "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1391 "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","ADDRSPACE","DEPLIBS",
1392 "CALL","TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK",
1393 "COLDCC_TOK","X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR",
1394 "SWITCH","INVOKE","UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV",
1395 "UREM","SREM","FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ",
1396 "NE","SLT","SGT","SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT",
1397 "OLE","OGE","ORD","UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE",
1398 "GETELEMENTPTR","TRUNC","ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP",
1399 "FPTOUI","FPTOSI","INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT",
1400 "INSERTELEMENT","SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET",
1401 "NOUNWIND","NOALIAS","BYVAL","NEST","READNONE","READONLY","GC","DEFAULT","HIDDEN",
1402 "PROTECTED","'='","','","'*'","'('","')'","'\\\\'","'['","'x'","']'","'<'","'>'",
1403 "'{'","'}'","'c'","ArithmeticOps","LogicalOps","CastOps","IPredicates","FPredicates",
1404 "IntType","FPType","LocalName","OptLocalName","OptLocalAssign","GlobalName",
1405 "OptGlobalAssign","GlobalAssign","GVInternalLinkage","GVExternalLinkage","GVVisibilityStyle",
1406 "FunctionDeclareLinkage","FunctionDefineLinkage","AliasLinkage","OptCallingConv",
1407 "ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs","OptGC","OptAlign","OptCAlign",
1408 "SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute","PrimType",
1409 "Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI","ConstVal",
1410 "ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef","Module","DefinitionList",
1411 "Definition","@1","@2","@3","@4","@5","@6","AsmBlock","TargetDefinition","LibrariesDefinition",
1412 "LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END",
1413 "Function","FunctionProto","OptSideEffect","ConstValueRef","SymbolicValueRef",
1414 "ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst",
1415 "JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall","InstVal",
1416 "OptVolatile","MemoryInst", NULL
1420 static const short yyr1[] = { 0,
1421 164, 164, 164, 164, 164, 164, 164, 164, 164, 165,
1422 165, 165, 165, 165, 165, 166, 166, 166, 166, 166,
1423 166, 166, 166, 166, 166, 166, 166, 167, 167, 167,
1424 167, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1425 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1426 168, 168, 168, 169, 170, 170, 170, 170, 170, 171,
1427 171, 171, 172, 172, 173, 173, 174, 174, 175, 175,
1428 176, 177, 177, 177, 177, 177, 178, 178, 178, 179,
1429 179, 179, 179, 180, 180, 180, 181, 181, 181, 181,
1430 181, 182, 182, 182, 183, 183, 183, 183, 183, 183,
1431 183, 184, 184, 184, 184, 184, 184, 184, 184, 184,
1432 185, 185, 186, 186, 186, 186, 186, 186, 187, 187,
1433 188, 188, 189, 189, 190, 190, 191, 192, 192, 193,
1434 193, 194, 194, 195, 195, 195, 195, 195, 195, 195,
1435 196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
1436 196, 196, 196, 196, 197, 198, 198, 199, 199, 200,
1437 200, 200, 200, 201, 201, 202, 202, 202, 202, 202,
1438 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
1439 202, 202, 202, 202, 202, 203, 203, 203, 203, 203,
1440 203, 203, 203, 203, 203, 204, 204, 205, 205, 206,
1441 206, 207, 207, 208, 208, 209, 209, 211, 210, 212,
1442 210, 210, 210, 210, 213, 210, 214, 210, 215, 210,
1443 216, 210, 210, 210, 210, 217, 218, 218, 219, 220,
1444 220, 220, 221, 221, 222, 222, 222, 222, 223, 224,
1445 224, 225, 226, 226, 227, 228, 229, 229, 230, 230,
1446 230, 230, 230, 230, 230, 230, 230, 230, 230, 231,
1447 231, 231, 231, 232, 232, 233, 234, 234, 235, 236,
1448 236, 236, 237, 237, 237, 237, 237, 237, 237, 237,
1449 237, 238, 238, 239, 240, 240, 241, 241, 241, 241,
1450 241, 242, 242, 243, 243, 244, 244, 244, 244, 244,
1451 244, 244, 244, 244, 244, 244, 244, 244, 245, 245,
1452 246, 246, 246, 246, 246, 246, 246, 246
1455 static const short yyr2[] = { 0,
1456 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1458 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1460 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1461 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1462 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1463 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1464 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1465 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1466 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1467 0, 2, 1, 1, 1, 1, 1, 1, 0, 2,
1468 0, 2, 0, 2, 0, 3, 2, 0, 1, 0,
1469 3, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1470 1, 1, 2, 6, 1, 2, 5, 5, 5, 5,
1471 3, 2, 5, 4, 2, 1, 1, 1, 3, 1,
1472 3, 1, 0, 1, 3, 4, 3, 3, 4, 4,
1473 3, 6, 5, 2, 2, 2, 2, 2, 2, 2,
1474 2, 2, 2, 2, 2, 6, 5, 8, 6, 6,
1475 7, 7, 6, 8, 8, 3, 1, 1, 1, 1,
1476 0, 2, 6, 1, 0, 1, 2, 0, 3, 0,
1477 3, 3, 3, 3, 0, 7, 0, 11, 0, 8,
1478 0, 8, 5, 2, 3, 1, 3, 3, 3, 3,
1479 1, 0, 5, 3, 1, 3, 1, 0, 10, 1,
1480 1, 4, 1, 1, 2, 3, 0, 1, 1, 1,
1481 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
1482 1, 1, 1, 1, 1, 2, 2, 2, 3, 2,
1483 0, 1, 2, 2, 3, 9, 9, 8, 14, 1,
1484 1, 6, 5, 2, 6, 7, 4, 4, 6, 6,
1485 0, 0, 3, 2, 1, 5, 5, 6, 6, 4,
1486 6, 4, 4, 6, 6, 2, 8, 1, 1, 0,
1487 3, 6, 3, 6, 2, 5, 7, 4
1490 static const short yydefact[] = { 70,
1491 60, 67, 61, 68, 62, 210, 208, 0, 0, 0,
1492 0, 0, 0, 80, 69, 70, 206, 84, 87, 0,
1493 0, 224, 0, 0, 65, 0, 71, 72, 74, 73,
1494 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1495 201, 207, 85, 86, 80, 211, 88, 89, 90, 91,
1496 80, 271, 209, 271, 0, 0, 232, 225, 226, 212,
1497 260, 261, 214, 134, 135, 136, 139, 138, 137, 140,
1498 141, 0, 0, 0, 0, 262, 263, 142, 213, 145,
1499 201, 201, 92, 200, 0, 95, 95, 272, 268, 66,
1500 243, 244, 245, 267, 227, 228, 231, 0, 163, 146,
1501 0, 0, 0, 0, 152, 164, 0, 0, 143, 163,
1502 0, 0, 94, 93, 0, 198, 199, 0, 0, 96,
1503 97, 98, 99, 100, 0, 246, 0, 310, 270, 0,
1504 229, 162, 111, 158, 160, 0, 0, 0, 0, 0,
1505 0, 151, 0, 0, 0, 0, 157, 0, 156, 0,
1506 223, 134, 135, 136, 139, 138, 137, 0, 0, 0,
1507 215, 101, 0, 240, 241, 242, 309, 295, 0, 0,
1508 0, 0, 95, 280, 281, 1, 2, 3, 4, 5,
1509 6, 7, 8, 9, 13, 14, 15, 10, 11, 12,
1510 0, 0, 0, 0, 0, 0, 16, 17, 18, 19,
1511 20, 21, 22, 23, 24, 25, 26, 27, 0, 0,
1512 0, 0, 0, 0, 0, 0, 0, 269, 95, 284,
1513 0, 308, 230, 155, 0, 119, 0, 0, 154, 0,
1514 165, 0, 119, 219, 221, 0, 202, 183, 184, 179,
1515 181, 180, 182, 185, 178, 174, 175, 0, 0, 0,
1516 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1517 0, 177, 176, 0, 130, 0, 294, 274, 0, 273,
1518 0, 0, 54, 0, 0, 28, 29, 30, 31, 32,
1519 33, 34, 35, 36, 37, 0, 52, 53, 48, 49,
1520 50, 51, 38, 39, 40, 41, 42, 43, 44, 45,
1521 46, 47, 0, 125, 125, 315, 0, 0, 306, 0,
1522 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1523 103, 105, 104, 102, 106, 107, 108, 109, 110, 112,
1524 161, 159, 148, 149, 150, 153, 0, 147, 130, 130,
1525 0, 0, 0, 0, 0, 0, 0, 0, 167, 197,
1526 0, 0, 0, 171, 0, 168, 0, 0, 0, 0,
1527 0, 216, 238, 249, 250, 251, 256, 252, 253, 254,
1528 255, 247, 0, 258, 265, 264, 266, 0, 275, 0,
1529 0, 0, 0, 0, 311, 0, 313, 292, 0, 0,
1530 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1531 0, 116, 115, 113, 114, 117, 118, 120, 144, 220,
1532 222, 0, 0, 0, 292, 0, 0, 0, 0, 0,
1533 166, 152, 164, 0, 169, 170, 0, 0, 0, 0,
1534 0, 0, 132, 130, 237, 111, 235, 0, 248, 0,
1535 0, 0, 0, 0, 0, 0, 0, 0, 0, 318,
1536 0, 0, 0, 302, 303, 0, 0, 0, 0, 300,
1537 0, 125, 0, 0, 0, 0, 0, 0, 0, 0,
1538 0, 196, 173, 0, 0, 0, 0, 217, 127, 133,
1539 131, 64, 0, 119, 0, 257, 0, 0, 291, 0,
1540 0, 125, 126, 125, 0, 0, 0, 0, 0, 0,
1541 296, 297, 291, 0, 316, 0, 203, 0, 0, 187,
1542 0, 0, 0, 0, 172, 0, 0, 0, 130, 63,
1543 234, 236, 111, 128, 0, 0, 0, 111, 111, 0,
1544 298, 299, 312, 314, 293, 0, 0, 301, 304, 305,
1545 0, 125, 0, 0, 0, 193, 0, 0, 189, 190,
1546 186, 218, 64, 129, 123, 259, 0, 0, 0, 0,
1547 0, 119, 285, 0, 119, 317, 191, 192, 0, 0,
1548 0, 233, 0, 121, 0, 278, 0, 0, 103, 105,
1549 111, 111, 111, 111, 0, 286, 307, 188, 194, 195,
1550 124, 0, 239, 276, 0, 277, 0, 288, 287, 0,
1551 0, 0, 122, 0, 0, 111, 111, 0, 0, 0,
1552 290, 289, 0, 283, 0, 0, 282, 0, 279, 0,
1556 static const short yydefgoto[] = { 259,
1557 260, 261, 286, 303, 158, 159, 76, 521, 12, 77,
1558 14, 15, 39, 40, 41, 45, 51, 115, 125, 330,
1559 224, 408, 333, 593, 574, 385, 433, 555, 362, 434,
1560 78, 160, 134, 150, 135, 136, 107, 350, 374, 351,
1561 118, 85, 151, 620, 16, 17, 19, 18, 265, 519,
1562 339, 340, 60, 22, 58, 98, 437, 438, 126, 166,
1563 52, 93, 53, 46, 440, 375, 80, 377, 270, 54,
1564 89, 90, 218, 578, 129, 309, 530, 450, 219, 220,
1568 static const short yypact[] = { 37,
1569 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 20, -137, -8,
1570 -61, 79, -48, 496,-32768, 1067,-32768, 36, 61, -26,
1571 15,-32768, 2, 151,-32768, 1438,-32768,-32768,-32768,-32768,
1572 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 142, 142,
1573 161,-32768,-32768,-32768, 142,-32768,-32768,-32768,-32768,-32768,
1574 142, 185,-32768, 1, 188, 202, 221,-32768,-32768,-32768,
1575 -32768,-32768, 77,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1576 -32768, 248, 252, 3, 505,-32768,-32768,-32768, 75,-32768,
1577 228, 228, 158,-32768, 83, 469, 469,-32768,-32768, 101,
1578 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -106, 1280,-32768,
1579 119, 128, 566, 77,-32768, 75, -115, 129,-32768, 1280,
1580 83, 83,-32768,-32768, 1320,-32768,-32768, 1495, 288,-32768,
1581 -32768,-32768,-32768,-32768, 1553,-32768, -5, 1763,-32768, 271,
1582 -32768,-32768, 75,-32768, 146, 144, 1593, 1593, 139, -89,
1583 1593,-32768, 298, 152, 1495, 1593, 77, 155, 75, 296,
1584 -32768, 38, 301, 308, 313, 314, 316, 233, 318, 894,
1585 251,-32768, 230,-32768,-32768,-32768,-32768,-32768, 273, 1611,
1586 59, 319, 469,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1587 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1588 317, 823, 1593, 1593, 1593, 1593,-32768,-32768,-32768,-32768,
1589 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1593, 1593,
1590 1593, 1593, 1593, 1593, 1593, 1593, 1593,-32768, 469,-32768,
1591 -4,-32768,-32768, 262, 1340,-32768, 26, -34,-32768, 171,
1592 75, 178,-32768,-32768, 75, 1320,-32768,-32768,-32768,-32768,
1593 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 317, 823, 181,
1594 189, 196, 197, 198, 125, 1651, 805, 332, 206, 207,
1595 211,-32768,-32768, 212, 187, 213,-32768, 77, 756,-32768,
1596 1055, 1055,-32768, 1055, 1553,-32768,-32768,-32768,-32768,-32768,
1597 -32768,-32768,-32768,-32768,-32768, 1593,-32768,-32768,-32768,-32768,
1598 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1599 -32768,-32768, 1593, 89, 121,-32768, 756, 73, 190, 210,
1600 222, 226, 235, 238, 756, 756, 334, 1553, 1593, 1593,
1601 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1602 -32768,-32768, 208,-32768,-32768,-32768, 239, 208, 187, 187,
1603 352, 240, 246, 1495, 1495, 1495, 1495, 1495,-32768,-32768,
1604 -105, 845, -111,-32768, -85,-32768, 1495, 1495, 1495, 388,
1605 5,-32768, 1380,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1606 -32768, 342, 1495,-32768,-32768,-32768,-32768, 255,-32768, 268,
1607 1055, 756, 756, 10,-32768, 18,-32768,-32768, 1055, 266,
1608 1593, 1593, 1593, 1593, 1593, 272, 277, 1593, 1055, 756,
1609 278,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1610 -32768, 1593, 1495, 1495,-32768, 279, 280, 282, 285, 1495,
1611 -32768, 264, 894, -77,-32768,-32768, 291, 295, 411, 297,
1612 428, 448,-32768, 187,-32768, 75, 303, 304,-32768, 433,
1613 -82, 439, 440, 307, 310, 311, 1055, 460, 1055, 315,
1614 321, 1055, 322, 75,-32768, 326, 327, 1055, 1055, 75,
1615 328, 329, 1593, 29, 333, 335, 103, 1495, 1495, 1495,
1616 1495,-32768,-32768, 309, 1495, 1495, 1593,-32768,-32768,-32768,
1617 -32768, 302, 1398,-32768, 336,-32768, 1055, 1055, 1669, 1055,
1618 1055, 329,-32768, 329, 1593, 1055, 339, 1593, 1593, 1593,
1619 -32768,-32768, 1669, 414,-32768, 756,-32768, 1495, 1495,-32768,
1620 340, 331, 344, 347,-32768, 345, 348, 67, 187,-32768,
1621 -32768,-32768, 75, 78, 446, 350, 349, 96, 75, 110,
1622 -32768,-32768,-32768,-32768,-32768, 312, 1055,-32768,-32768,-32768,
1623 124, 329, 353, 354, 1495,-32768, 1495, 1495,-32768,-32768,
1624 -32768,-32768, 302,-32768, 430,-32768, 487, -3, 615, 615,
1625 1709,-32768,-32768, 351,-32768,-32768,-32768,-32768, 360, 369,
1626 372,-32768, 532, 399, 1055,-32768, 1190, 8, 394, 395,
1627 -32768,-32768, 96, 75, 123,-32768, 208,-32768,-32768,-32768,
1628 -32768, 527,-32768,-32768, 400,-32768, 1190, 262, 262, 615,
1629 615, 533,-32768, 535, 404,-32768,-32768, 1055, 1055, 539,
1630 262, 262, 485,-32768, 1055, 542,-32768, 1055,-32768, 561,
1634 static const short yypgoto[] = { 436,
1635 437, 438, 320, 323, -171,-32768, 0, 14, 481, 17,
1636 -32768,-32768,-32768,-32768, 55,-32768,-32768,-32768, -138,-32768,
1637 -430,-32768, -229,-32768,-32768, -295, 51,-32768, -325,-32768,
1638 -32768, -24, 359, -107,-32768, 477, 488, -113, -157, -245,
1639 19, 135, 356,-32768,-32768, 577,-32768,-32768,-32768,-32768,
1640 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 507,-32768,
1641 -32768,-32768,-32768,-32768,-32768, -543, -112, 111, -186,-32768,
1642 541,-32768,-32768,-32768,-32768,-32768, 93, 182,-32768,-32768,
1650 static const short yytable[] = { 11,
1651 274, 79, 262, 338, 161, 482, 102, 273, 306, 387,
1652 353, 355, 23, 410, 411, 11, 13, 163, 273, 108,
1653 447, 88, 164, 310, 311, 312, 313, 314, 449, 91,
1654 317, 234, 13, 595, 275, 141, -205, 237, 431, 420,
1655 -54, -54, -54, -54, 130, 420, 142, 263, 425, 24,
1656 106, 131, 421, 605, -66, 1, 2, 432, 3, 4,
1657 5, 141, 448, 238, 239, 420, 6, 7, 420, 271,
1658 448, 20, 230, 420, 133, 272, 426, 486, 106, 108,
1659 318, 43, 108, 44, 474, 133, 21, 8, 25, 11,
1660 149, 9, 553, 81, 82, 10, 26, 559, 560, 86,
1661 149, 27, 47, 48, 49, 87, 424, 50, 481, 319,
1662 320, 431, 227, 228, 116, 117, 231, 109, 110, 1,
1663 108, 235, 3, 55, 5, 335, 108, 441, 108, 145,
1664 146, 61, 62, 401, 104, 152, 153, 154, 155, 156,
1665 157, 70, 108, 1, 2, 269, 3, 4, 5, -140,
1666 598, 599, 600, 601, 576, 165, 376, 57, 376, 376,
1667 602, 376, 92, 103, 56, 596, 505, 381, 304, 305,
1668 269, 307, 59, 71, 108, 611, 612, 109, 110, 266,
1669 109, 110, 507, 334, 308, 269, 269, 269, 269, 269,
1670 315, 316, 269, 552, 376, 83, 533, 84, 534, 113,
1671 133, 114, 376, 376, 453, 88, 455, 456, 457, 95,
1672 399, 149, 402, 403, 404, 111, 112, 405, 109, 110,
1673 551, 406, 407, 96, 109, 110, 109, 110, 389, 99,
1674 415, 416, 417, 418, 419, 240, 241, 242, 243, 384,
1675 109, 110, 97, 427, 428, 429, 566, -140, -140, 2,
1676 149, 100, 4, 495, 524, 101, 510, 402, 403, 404,
1677 561, 382, 405, 562, 84, 262, 406, 407, 376, 376,
1678 376, 386, 109, 110, 561, 137, 376, 565, 383, 72,
1679 73, 143, 349, 74, 138, 75, 376, 376, 36, 37,
1680 38, 162, 223, 149, 400, 269, 225, 226, 229, 465,
1681 466, 232, 61, 62, 264, 233, 472, 236, 535, -55,
1682 263, 538, 539, 540, 1, 2, -56, 3, 4, 5,
1683 1, -59, -58, 3, -57, 5, 244, 423, 267, 273,
1684 336, 337, 585, 344, 376, 587, 376, 361, 436, 376,
1685 390, 345, 402, 403, 404, 376, 376, 405, 346, 347,
1686 348, 406, 407, 356, 511, 512, 513, 514, 357, 358,
1687 391, 516, 517, 359, 360, 363, 269, 454, 269, 269,
1688 269, 398, 392, 460, 376, 376, 393, 376, 376, 321,
1689 322, 378, 379, 376, 380, 394, 577, 464, 395, 412,
1690 409, 430, 413, 376, 543, 544, 323, 324, 414, 325,
1691 326, 439, 327, 328, 329, 442, 597, 276, 277, 278,
1692 279, 280, 281, 282, 283, 284, 285, 388, 443, 321,
1693 322, 452, 458, 473, 376, 396, 397, 459, 463, 468,
1694 469, 569, 470, 570, 571, 471, 323, 324, 506, 325,
1695 326, 475, 327, 328, 329, 476, 376, 376, 477, 479,
1696 478, 480, 518, 483, 485, 487, 488, 484, 523, 489,
1697 490, 491, 376, 493, 529, 495, 448, 556, 515, 563,
1698 269, 496, 498, 269, 269, 269, 499, 500, 529, 504,
1699 503, 520, 573, 508, 546, 509, 525, 376, 376, 537,
1700 545, 444, 445, 446, 547, 376, 376, 548, 549, 451,
1701 557, 550, 376, 575, 558, 376, 567, 568, 586, 461,
1702 462, 61, 62, 588, 104, 64, 65, 66, 67, 68,
1703 69, 70, 589, 1, 2, 590, 3, 4, 5, 119,
1704 120, 121, 122, 123, 124, 591, 584, 28, 29, 30,
1705 31, 32, 33, 34, 592, 35, -17, -18, 603, 608,
1706 604, 609, 520, 71, 610, 615, 616, 492, 618, 494,
1707 621, 622, 497, 215, 216, 217, 572, 342, 501, 502,
1708 128, 343, 61, 62, 554, 104, 64, 65, 66, 67,
1709 68, 69, 70, 332, 1, 2, 144, 3, 4, 5,
1710 140, 341, 42, 127, 94, 541, 467, 526, 527, 0,
1711 531, 532, 0, 0, 0, 0, 536, 0, 0, 0,
1712 0, 0, 0, 0, 71, 0, 542, 364, 365, 0,
1713 0, 61, 62, 366, 0, 0, 0, 0, 0, 0,
1714 0, 0, 0, 1, 2, 0, 3, 4, 5, 367,
1715 368, 369, 36, 37, 38, 0, 0, 564, 0, 0,
1716 0, 0, 0, 0, 370, 371, 0, 0, 0, 72,
1717 73, 0, 0, 74, 0, 75, 105, 0, 0, 581,
1718 582, 0, 372, 0, 0, 0, 0, 0, 0, 0,
1719 0, 0, 0, 0, 0, 594, 0, 0, 176, 177,
1720 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1721 188, 189, 190, 248, 249, 0, 0, 0, 0, 0,
1722 606, 607, 0, 0, 0, 0, 0, 0, 613, 614,
1723 72, 73, 0, 0, 74, 617, 75, 139, 619, 0,
1724 250, 197, 579, 580, 200, 201, 202, 203, 204, 205,
1725 206, 207, 208, 0, 251, 0, 252, 253, 254, 323,
1726 324, 0, 325, 326, 0, 327, 328, 329, 364, 365,
1727 0, 0, 61, 62, 366, 0, 0, 0, 0, 0,
1728 0, 0, 0, 373, 1, 2, 0, 3, 4, 5,
1729 367, 368, 369, 0, 0, 0, 0, 0, 0, 0,
1730 0, 0, 0, 0, 0, 370, 371, 0, 0, 0,
1731 0, 0, 0, 0, 0, 0, 0, 0, 0, 108,
1732 0, 61, 62, 372, 104, 152, 153, 154, 155, 156,
1733 157, 70, 0, 1, 2, 0, 3, 4, 5, 176,
1734 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1735 187, 188, 189, 190, 248, 249, 0, 0, 287, 288,
1736 0, 61, 62, 71, 104, 152, 153, 154, 155, 156,
1737 157, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1738 0, 250, 197, 198, 199, 200, 201, 202, 203, 204,
1739 205, 206, 207, 208, 0, 251, 0, 252, 253, 254,
1740 0, 0, 0, 71, 0, 0, 0, 0, 0, 0,
1741 61, 62, 0, 0, 0, 0, 0, 109, 110, 0,
1742 0, 0, 1, 2, 373, 3, 4, 5, 245, 289,
1743 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
1744 300, 301, 302, 246, 247, 0, 0, 0, 0, 0,
1745 0, 0, 0, 0, 0, 0, 0, 108, 0, 0,
1746 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
1747 73, 0, 0, 74, 0, 75, 354, 176, 177, 178,
1748 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
1749 189, 190, 248, 249, 0, 0, 0, 0, 0, 0,
1750 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
1751 73, 0, 0, 74, 0, 75, 422, 0, 0, 250,
1752 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
1753 207, 208, 0, 251, 0, 252, 253, 254, 0, 0,
1754 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1755 0, 0, 0, 0, 0, 109, 110, 0, 0, 255,
1756 0, 0, 256, 0, 257, 0, 258, 364, 365, 0,
1757 0, 61, 62, 366, 0, 0, -204, 0, 0, 0,
1758 0, 0, 0, 1, 2, 0, 3, 4, 5, 367,
1759 368, 369, 0, 0, -66, 1, 2, 0, 3, 4,
1760 5, 0, 0, 0, 370, 371, 6, 7, 0, 0,
1761 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1762 0, 0, 372, 0, 0, 0, 0, 8, 0, 0,
1763 0, 9, 0, 0, 0, 10, 0, 0, 176, 177,
1764 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1765 188, 189, 190, 248, 249, 0, 0, 0, 0, 0,
1766 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1767 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1768 250, 197, 198, 199, 200, 201, 202, 203, 204, 205,
1769 206, 207, 208, 0, 251, 0, 252, 253, 254, 0,
1770 0, 0, 364, 365, 0, 0, 0, 0, 366, 0,
1771 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1772 0, 0, 0, 373, 367, 368, 369, 0, 0, 0,
1773 0, 0, 0, 0, 0, 0, 0, 0, 0, 370,
1774 371, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1775 0, 0, 0, 0, 0, 0, 0, 372, 0, 0,
1776 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1777 0, 0, 0, 176, 177, 178, 179, 180, 181, 182,
1778 183, 184, 185, 186, 187, 188, 189, 190, 248, 249,
1779 0, 0, 0, 0, 0, 0, 61, 62, 0, 104,
1780 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1781 0, 3, 4, 5, 0, 250, 197, 198, 199, 200,
1782 201, 202, 203, 204, 205, 206, 207, 208, 132, 251,
1783 0, 252, 253, 254, 0, 0, 61, 62, 71, 147,
1784 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1785 0, 3, 4, 5, 0, 0, 61, 62, 373, 104,
1786 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1787 0, 3, 4, 5, 0, 0, 0, 0, 71, 0,
1788 0, 0, 0, 0, 0, 0, 0, 0, 331, 0,
1789 0, 0, 0, 0, 0, 0, 61, 62, 71, 104,
1790 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1791 0, 3, 4, 5, 61, 62, 0, 104, 64, 65,
1792 66, 67, 68, 69, 70, 0, 1, 2, 435, 3,
1793 4, 5, 0, 0, 0, 0, 0, 0, 71, 0,
1794 0, 0, 0, 0, 72, 73, 522, 0, 74, 0,
1795 75, 148, 0, 0, 61, 62, 71, 63, 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, 72, 73, 0, 0, 74, 0,
1799 75, 0, 0, 0, 0, 0, 71, 0, 0, 0,
1800 0, 0, 0, 0, 72, 73, 0, 0, 74, 0,
1801 75, 61, 62, 0, 104, 152, 153, 154, 155, 156,
1802 157, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1803 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1804 0, 0, 0, 0, 72, 73, 0, 0, 74, 0,
1805 75, 0, 0, 71, 0, 0, 0, 0, 0, 0,
1806 0, 0, 72, 73, 0, 0, 74, 0, 75, 61,
1807 62, 0, 147, 64, 65, 66, 67, 68, 69, 70,
1808 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
1809 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1810 0, 0, 72, 73, 0, 0, 74, 0, 75, 61,
1811 62, 71, 104, 64, 65, 66, 67, 68, 69, 70,
1812 0, 1, 2, 0, 3, 4, 5, 61, 62, 0,
1813 268, 64, 65, 66, 67, 68, 69, 70, 0, 1,
1814 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
1815 0, 71, 0, 0, 0, 0, 0, 0, 0, 72,
1816 73, 0, 0, 74, 0, 75, 0, 61, 62, 71,
1817 104, 152, 153, 154, 155, 156, 157, 70, 0, 1,
1818 2, 0, 3, 4, 5, 61, 62, 0, 104, 64,
1819 65, 66, 67, 68, 69, 528, 0, 1, 2, 0,
1820 3, 4, 5, 0, 0, 0, 0, 0, 0, 71,
1821 0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
1822 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1823 65, 66, 67, 68, 69, 583, 0, 1, 2, 0,
1824 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1825 0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
1826 0, 74, 0, 75, 0, 0, 0, 71, 0, 0,
1827 0, 0, 0, 0, 0, 72, 73, 0, 0, 74,
1828 0, 75, 0, 0, 0, 0, 0, 0, 0, 0,
1829 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1830 0, 0, 0, 0, 0, 0, 0, 0, 167, 0,
1831 0, 0, 0, 0, 0, 72, 73, 0, 0, 74,
1832 0, 352, 0, 0, 0, 0, 0, 0, 168, 169,
1833 0, 0, 0, 72, 73, 0, 0, 74, 0, 75,
1834 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
1835 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1836 190, 191, 192, 0, 0, 0, 0, 0, 0, 0,
1837 0, 0, 0, 72, 73, 0, 0, 74, 0, 75,
1838 0, 0, 0, 193, 194, 195, 0, 0, 196, 197,
1839 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1840 208, 209, 210, 211, 212, 213, 214
1843 static const short yycheck[] = { 0,
1844 172, 26, 160, 233, 118, 436, 4, 11, 195, 305,
1845 256, 257, 150, 339, 340, 16, 0, 125, 11, 54,
1846 11, 21, 28, 210, 211, 212, 213, 214, 11, 29,
1847 217, 145, 16, 577, 173, 151, 0, 150, 34, 151,
1848 3, 4, 5, 6, 151, 151, 162, 160, 160, 58,
1849 75, 158, 158, 597, 18, 19, 20, 53, 22, 23,
1850 24, 151, 53, 26, 27, 151, 30, 31, 151, 11,
1851 53, 52, 162, 151, 99, 17, 162, 160, 103, 54,
1852 219, 46, 54, 48, 162, 110, 67, 51, 150, 90,
1853 115, 55, 523, 39, 40, 59, 18, 528, 529, 45,
1854 125, 150, 42, 43, 44, 51, 352, 47, 434, 114,
1855 115, 34, 137, 138, 32, 33, 141, 152, 153, 19,
1856 54, 146, 22, 150, 24, 160, 54, 373, 54, 111,
1857 112, 7, 8, 320, 10, 11, 12, 13, 14, 15,
1858 16, 17, 54, 19, 20, 170, 22, 23, 24, 54,
1859 581, 582, 583, 584, 158, 161, 269, 156, 271, 272,
1860 38, 274, 162, 161, 150, 158, 462, 275, 193, 194,
1861 195, 196, 22, 49, 54, 606, 607, 152, 153, 163,
1862 152, 153, 154, 158, 209, 210, 211, 212, 213, 214,
1863 215, 216, 217, 519, 307, 35, 492, 37, 494, 42,
1864 225, 44, 315, 316, 391, 21, 393, 394, 395, 22,
1865 318, 236, 135, 136, 137, 81, 82, 140, 152, 153,
1866 154, 144, 145, 22, 152, 153, 152, 153, 156, 153,
1867 344, 345, 346, 347, 348, 3, 4, 5, 6, 151,
1868 152, 153, 22, 357, 358, 359, 542, 152, 153, 20,
1869 275, 4, 23, 151, 484, 4, 154, 135, 136, 137,
1870 151, 286, 140, 154, 37, 423, 144, 145, 381, 382,
1871 383, 151, 152, 153, 151, 157, 389, 154, 303, 155,
1872 156, 153, 158, 159, 157, 161, 399, 400, 147, 148,
1873 149, 4, 22, 318, 319, 320, 151, 154, 160, 413,
1874 414, 4, 7, 8, 54, 154, 420, 153, 495, 9,
1875 423, 498, 499, 500, 19, 20, 9, 22, 23, 24,
1876 19, 9, 9, 22, 9, 24, 9, 352, 56, 11,
1877 160, 154, 562, 153, 447, 565, 449, 151, 363, 452,
1878 151, 153, 135, 136, 137, 458, 459, 140, 153, 153,
1879 153, 144, 145, 22, 468, 469, 470, 471, 153, 153,
1880 151, 475, 476, 153, 153, 153, 391, 392, 393, 394,
1881 395, 38, 151, 398, 487, 488, 151, 490, 491, 118,
1882 119, 271, 272, 496, 274, 151, 558, 412, 151, 38,
1883 152, 4, 153, 506, 508, 509, 135, 136, 153, 138,
1884 139, 60, 141, 142, 143, 151, 578, 91, 92, 93,
1885 94, 95, 96, 97, 98, 99, 100, 307, 151, 118,
1886 119, 156, 151, 160, 537, 315, 316, 151, 151, 151,
1887 151, 545, 151, 547, 548, 151, 135, 136, 463, 138,
1888 139, 151, 141, 142, 143, 151, 559, 560, 38, 22,
1889 154, 4, 477, 151, 22, 17, 17, 154, 483, 153,
1890 151, 151, 575, 4, 489, 151, 53, 22, 160, 158,
1891 495, 151, 151, 498, 499, 500, 151, 151, 503, 151,
1892 153, 482, 53, 151, 154, 151, 151, 600, 601, 151,
1893 151, 381, 382, 383, 151, 608, 609, 151, 154, 389,
1894 151, 154, 615, 17, 156, 618, 154, 154, 158, 399,
1895 400, 7, 8, 154, 10, 11, 12, 13, 14, 15,
1896 16, 17, 154, 19, 20, 154, 22, 23, 24, 61,
1897 62, 63, 64, 65, 66, 4, 561, 42, 43, 44,
1898 45, 46, 47, 48, 146, 50, 153, 153, 22, 17,
1899 151, 17, 553, 49, 151, 17, 72, 447, 17, 449,
1900 0, 0, 452, 128, 128, 128, 553, 248, 458, 459,
1901 90, 249, 7, 8, 524, 10, 11, 12, 13, 14,
1902 15, 16, 17, 225, 19, 20, 110, 22, 23, 24,
1903 103, 236, 16, 87, 54, 503, 415, 487, 488, -1,
1904 490, 491, -1, -1, -1, -1, 496, -1, -1, -1,
1905 -1, -1, -1, -1, 49, -1, 506, 3, 4, -1,
1906 -1, 7, 8, 9, -1, -1, -1, -1, -1, -1,
1907 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
1908 26, 27, 147, 148, 149, -1, -1, 537, -1, -1,
1909 -1, -1, -1, -1, 40, 41, -1, -1, -1, 155,
1910 156, -1, -1, 159, -1, 161, 162, -1, -1, 559,
1911 560, -1, 58, -1, -1, -1, -1, -1, -1, -1,
1912 -1, -1, -1, -1, -1, 575, -1, -1, 74, 75,
1913 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1914 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
1915 600, 601, -1, -1, -1, -1, -1, -1, 608, 609,
1916 155, 156, -1, -1, 159, 615, 161, 162, 618, -1,
1917 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1918 126, 127, 128, -1, 130, -1, 132, 133, 134, 135,
1919 136, -1, 138, 139, -1, 141, 142, 143, 3, 4,
1920 -1, -1, 7, 8, 9, -1, -1, -1, -1, -1,
1921 -1, -1, -1, 159, 19, 20, -1, 22, 23, 24,
1922 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
1923 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
1924 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
1925 -1, 7, 8, 58, 10, 11, 12, 13, 14, 15,
1926 16, 17, -1, 19, 20, -1, 22, 23, 24, 74,
1927 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1928 85, 86, 87, 88, 89, 90, -1, -1, 26, 27,
1929 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
1930 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1931 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1932 125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
1933 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
1934 7, 8, -1, -1, -1, -1, -1, 152, 153, -1,
1935 -1, -1, 19, 20, 159, 22, 23, 24, 25, 97,
1936 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
1937 108, 109, 110, 40, 41, -1, -1, -1, -1, -1,
1938 -1, -1, -1, -1, -1, -1, -1, 54, -1, -1,
1939 -1, -1, -1, -1, -1, -1, -1, -1, -1, 155,
1940 156, -1, -1, 159, -1, 161, 162, 74, 75, 76,
1941 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1942 87, 88, 89, 90, -1, -1, -1, -1, -1, -1,
1943 -1, -1, -1, -1, -1, -1, -1, -1, -1, 155,
1944 156, -1, -1, 159, -1, 161, 162, -1, -1, 116,
1945 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1946 127, 128, -1, 130, -1, 132, 133, 134, -1, -1,
1947 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1948 -1, -1, -1, -1, -1, 152, 153, -1, -1, 156,
1949 -1, -1, 159, -1, 161, -1, 163, 3, 4, -1,
1950 -1, 7, 8, 9, -1, -1, 0, -1, -1, -1,
1951 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
1952 26, 27, -1, -1, 18, 19, 20, -1, 22, 23,
1953 24, -1, -1, -1, 40, 41, 30, 31, -1, -1,
1954 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1955 -1, -1, 58, -1, -1, -1, -1, 51, -1, -1,
1956 -1, 55, -1, -1, -1, 59, -1, -1, 74, 75,
1957 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1958 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
1959 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1960 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1961 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1962 126, 127, 128, -1, 130, -1, 132, 133, 134, -1,
1963 -1, -1, 3, 4, -1, -1, -1, -1, 9, -1,
1964 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1965 -1, -1, -1, 159, 25, 26, 27, -1, -1, -1,
1966 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
1967 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1968 -1, -1, -1, -1, -1, -1, -1, 58, -1, -1,
1969 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1970 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
1971 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
1972 -1, -1, -1, -1, -1, -1, 7, 8, -1, 10,
1973 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1974 -1, 22, 23, 24, -1, 116, 117, 118, 119, 120,
1975 121, 122, 123, 124, 125, 126, 127, 128, 39, 130,
1976 -1, 132, 133, 134, -1, -1, 7, 8, 49, 10,
1977 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1978 -1, 22, 23, 24, -1, -1, 7, 8, 159, 10,
1979 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1980 -1, 22, 23, 24, -1, -1, -1, -1, 49, -1,
1981 -1, -1, -1, -1, -1, -1, -1, -1, 39, -1,
1982 -1, -1, -1, -1, -1, -1, 7, 8, 49, 10,
1983 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1984 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
1985 13, 14, 15, 16, 17, -1, 19, 20, 39, 22,
1986 23, 24, -1, -1, -1, -1, -1, -1, 49, -1,
1987 -1, -1, -1, -1, 155, 156, 39, -1, 159, -1,
1988 161, 122, -1, -1, 7, 8, 49, 10, 11, 12,
1989 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1990 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
1991 -1, -1, -1, -1, 155, 156, -1, -1, 159, -1,
1992 161, -1, -1, -1, -1, -1, 49, -1, -1, -1,
1993 -1, -1, -1, -1, 155, 156, -1, -1, 159, -1,
1994 161, 7, 8, -1, 10, 11, 12, 13, 14, 15,
1995 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1996 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1997 -1, -1, -1, -1, 155, 156, -1, -1, 159, -1,
1998 161, -1, -1, 49, -1, -1, -1, -1, -1, -1,
1999 -1, -1, 155, 156, -1, -1, 159, -1, 161, 7,
2000 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2001 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2002 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2003 -1, -1, 155, 156, -1, -1, 159, -1, 161, 7,
2004 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2005 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2006 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2007 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2008 -1, 49, -1, -1, -1, -1, -1, -1, -1, 155,
2009 156, -1, -1, 159, -1, 161, -1, 7, 8, 49,
2010 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2011 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2012 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2013 22, 23, 24, -1, -1, -1, -1, -1, -1, 49,
2014 -1, -1, -1, -1, -1, -1, -1, 155, 156, -1,
2015 -1, 159, -1, 161, -1, 7, 8, 49, 10, 11,
2016 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2017 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2018 -1, -1, -1, -1, -1, -1, -1, 155, 156, -1,
2019 -1, 159, -1, 161, -1, -1, -1, 49, -1, -1,
2020 -1, -1, -1, -1, -1, 155, 156, -1, -1, 159,
2021 -1, 161, -1, -1, -1, -1, -1, -1, -1, -1,
2022 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2023 -1, -1, -1, -1, -1, -1, -1, -1, 36, -1,
2024 -1, -1, -1, -1, -1, 155, 156, -1, -1, 159,
2025 -1, 161, -1, -1, -1, -1, -1, -1, 56, 57,
2026 -1, -1, -1, 155, 156, -1, -1, 159, -1, 161,
2027 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2028 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2029 88, 89, 90, -1, -1, -1, -1, -1, -1, -1,
2030 -1, -1, -1, 155, 156, -1, -1, 159, -1, 161,
2031 -1, -1, -1, 111, 112, 113, -1, -1, 116, 117,
2032 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2033 128, 129, 130, 131, 132, 133, 134
2035 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2036 #line 3 "/usr/share/bison.simple"
2037 /* This file comes from bison-1.28. */
2039 /* Skeleton output parser for bison,
2040 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2042 This program is free software; you can redistribute it and/or modify
2043 it under the terms of the GNU General Public License as published by
2044 the Free Software Foundation; either version 2, or (at your option)
2047 This program is distributed in the hope that it will be useful,
2048 but WITHOUT ANY WARRANTY; without even the implied warranty of
2049 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2050 GNU General Public License for more details.
2052 You should have received a copy of the GNU General Public License
2053 along with this program; if not, write to the Free Software
2054 Foundation, Inc., 59 Temple Place - Suite 330,
2055 Boston, MA 02111-1307, USA. */
2057 /* As a special exception, when this file is copied by Bison into a
2058 Bison output file, you may use that output file without restriction.
2059 This special exception was added by the Free Software Foundation
2060 in version 1.24 of Bison. */
2062 /* This is the parser code that is written into each bison parser
2063 when the %semantic_parser declaration is not specified in the grammar.
2064 It was written by Richard Stallman by simplifying the hairy parser
2065 used when %semantic_parser is specified. */
2067 #ifndef YYSTACK_USE_ALLOCA
2069 #define YYSTACK_USE_ALLOCA
2070 #else /* alloca not defined */
2072 #define YYSTACK_USE_ALLOCA
2073 #define alloca __builtin_alloca
2074 #else /* not GNU C. */
2075 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2076 #define YYSTACK_USE_ALLOCA
2078 #else /* not sparc */
2079 /* We think this test detects Watcom and Microsoft C. */
2080 /* This used to test MSDOS, but that is a bad idea
2081 since that symbol is in the user namespace. */
2082 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2083 #if 0 /* No need for malloc.h, which pollutes the namespace;
2084 instead, just don't use alloca. */
2087 #else /* not MSDOS, or __TURBOC__ */
2089 /* I don't know what this was needed for, but it pollutes the namespace.
2090 So I turned it off. rms, 2 May 1997. */
2091 /* #include <malloc.h> */
2093 #define YYSTACK_USE_ALLOCA
2094 #else /* not MSDOS, or __TURBOC__, or _AIX */
2096 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2097 and on HPUX 10. Eventually we can turn this on. */
2098 #define YYSTACK_USE_ALLOCA
2099 #define alloca __builtin_alloca
2102 #endif /* not _AIX */
2103 #endif /* not MSDOS, or __TURBOC__ */
2104 #endif /* not sparc */
2105 #endif /* not GNU C */
2106 #endif /* alloca not defined */
2107 #endif /* YYSTACK_USE_ALLOCA not defined */
2109 #ifdef YYSTACK_USE_ALLOCA
2110 #define YYSTACK_ALLOC alloca
2112 #define YYSTACK_ALLOC malloc
2115 /* Note: there must be only one dollar sign in this file.
2116 It is replaced by the list of actions, each action
2117 as one case of the switch. */
2119 #define yyerrok (yyerrstatus = 0)
2120 #define yyclearin (yychar = YYEMPTY)
2123 #define YYACCEPT goto yyacceptlab
2124 #define YYABORT goto yyabortlab
2125 #define YYERROR goto yyerrlab1
2126 /* Like YYERROR except do call yyerror.
2127 This remains here temporarily to ease the
2128 transition to the new meaning of YYERROR, for GCC.
2129 Once GCC version 2 has supplanted version 1, this can go. */
2130 #define YYFAIL goto yyerrlab
2131 #define YYRECOVERING() (!!yyerrstatus)
2132 #define YYBACKUP(token, value) \
2134 if (yychar == YYEMPTY && yylen == 1) \
2135 { yychar = (token), yylval = (value); \
2136 yychar1 = YYTRANSLATE (yychar); \
2141 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2145 #define YYERRCODE 256
2148 #define YYLEX yylex()
2154 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2156 #define YYLEX yylex(&yylval, &yylloc)
2158 #else /* not YYLSP_NEEDED */
2160 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2162 #define YYLEX yylex(&yylval)
2164 #endif /* not YYLSP_NEEDED */
2167 /* If nonreentrant, generate the variables here */
2171 int yychar; /* the lookahead symbol */
2172 YYSTYPE yylval; /* the semantic value of the */
2173 /* lookahead symbol */
2176 YYLTYPE yylloc; /* location data for the lookahead */
2180 int yynerrs; /* number of parse errors so far */
2181 #endif /* not YYPURE */
2184 int yydebug; /* nonzero means print parse trace */
2185 /* Since this is uninitialized, it does not stop multiple parsers
2189 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2192 #define YYINITDEPTH 200
2195 /* YYMAXDEPTH is the maximum size the stacks can grow to
2196 (effective only if the built-in stack extension method is used). */
2203 #define YYMAXDEPTH 10000
2206 /* Define __yy_memcpy. Note that the size argument
2207 should be passed with type unsigned int, because that is what the non-GCC
2208 definitions require. With GCC, __builtin_memcpy takes an arg
2209 of type size_t, but it can handle unsigned int. */
2211 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2212 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2213 #else /* not GNU C or C++ */
2216 /* This is the most reliable way to avoid incompatibilities
2217 in available built-in functions on various systems. */
2219 __yy_memcpy (to, from, count)
2224 register char *f = from;
2225 register char *t = to;
2226 register int i = count;
2232 #else /* __cplusplus */
2234 /* This is the most reliable way to avoid incompatibilities
2235 in available built-in functions on various systems. */
2237 __yy_memcpy (char *to, char *from, unsigned int count)
2239 register char *t = to;
2240 register char *f = from;
2241 register int i = count;
2250 #line 217 "/usr/share/bison.simple"
2252 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2253 into yyparse. The argument should have type void *.
2254 It should actually point to an object.
2255 Grammar actions can access the variable by casting it
2256 to the proper pointer type. */
2258 #ifdef YYPARSE_PARAM
2260 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2261 #define YYPARSE_PARAM_DECL
2262 #else /* not __cplusplus */
2263 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2264 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2265 #endif /* not __cplusplus */
2266 #else /* not YYPARSE_PARAM */
2267 #define YYPARSE_PARAM_ARG
2268 #define YYPARSE_PARAM_DECL
2269 #endif /* not YYPARSE_PARAM */
2271 /* Prevent warning if -Wstrict-prototypes. */
2273 #ifdef YYPARSE_PARAM
2274 int yyparse (void *);
2281 yyparse(YYPARSE_PARAM_ARG)
2284 register int yystate;
2286 register short *yyssp;
2287 register YYSTYPE *yyvsp;
2288 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2289 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2291 short yyssa[YYINITDEPTH]; /* the state stack */
2292 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2294 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2295 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2298 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2299 YYLTYPE *yyls = yylsa;
2302 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2304 #define YYPOPSTACK (yyvsp--, yyssp--)
2307 int yystacksize = YYINITDEPTH;
2308 int yyfree_stacks = 0;
2319 YYSTYPE yyval; /* the variable used to return */
2320 /* semantic values from the action */
2327 fprintf(stderr, "Starting parse\n");
2333 yychar = YYEMPTY; /* Cause a token to be read. */
2335 /* Initialize stack pointers.
2336 Waste one element of value and location stack
2337 so that they stay on the same level as the state stack.
2338 The wasted elements are never initialized. */
2346 /* Push a new state, which is found in yystate . */
2347 /* In all cases, when you get here, the value and location stacks
2348 have just been pushed. so pushing a state here evens the stacks. */
2353 if (yyssp >= yyss + yystacksize - 1)
2355 /* Give user a chance to reallocate the stack */
2356 /* Use copies of these so that the &'s don't force the real ones into memory. */
2357 YYSTYPE *yyvs1 = yyvs;
2358 short *yyss1 = yyss;
2360 YYLTYPE *yyls1 = yyls;
2363 /* Get the current used size of the three stacks, in elements. */
2364 int size = yyssp - yyss + 1;
2367 /* Each stack pointer address is followed by the size of
2368 the data in use in that stack, in bytes. */
2370 /* This used to be a conditional around just the two extra args,
2371 but that might be undefined if yyoverflow is a macro. */
2372 yyoverflow("parser stack overflow",
2373 &yyss1, size * sizeof (*yyssp),
2374 &yyvs1, size * sizeof (*yyvsp),
2375 &yyls1, size * sizeof (*yylsp),
2378 yyoverflow("parser stack overflow",
2379 &yyss1, size * sizeof (*yyssp),
2380 &yyvs1, size * sizeof (*yyvsp),
2384 yyss = yyss1; yyvs = yyvs1;
2388 #else /* no yyoverflow */
2389 /* Extend the stack our own way. */
2390 if (yystacksize >= YYMAXDEPTH)
2392 yyerror("parser stack overflow");
2404 if (yystacksize > YYMAXDEPTH)
2405 yystacksize = YYMAXDEPTH;
2406 #ifndef YYSTACK_USE_ALLOCA
2409 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2410 __yy_memcpy ((char *)yyss, (char *)yyss1,
2411 size * (unsigned int) sizeof (*yyssp));
2412 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2413 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2414 size * (unsigned int) sizeof (*yyvsp));
2416 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2417 __yy_memcpy ((char *)yyls, (char *)yyls1,
2418 size * (unsigned int) sizeof (*yylsp));
2420 #endif /* no yyoverflow */
2422 yyssp = yyss + size - 1;
2423 yyvsp = yyvs + size - 1;
2425 yylsp = yyls + size - 1;
2430 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2433 if (yyssp >= yyss + yystacksize - 1)
2439 fprintf(stderr, "Entering state %d\n", yystate);
2445 /* Do appropriate processing given the current state. */
2446 /* Read a lookahead token if we need one and don't already have one. */
2449 /* First try to decide what to do without reference to lookahead token. */
2451 yyn = yypact[yystate];
2455 /* Not known => get a lookahead token if don't already have one. */
2457 /* yychar is either YYEMPTY or YYEOF
2458 or a valid token in external form. */
2460 if (yychar == YYEMPTY)
2464 fprintf(stderr, "Reading a token: ");
2469 /* Convert token to internal form (in yychar1) for indexing tables with */
2471 if (yychar <= 0) /* This means end of input. */
2474 yychar = YYEOF; /* Don't call YYLEX any more */
2478 fprintf(stderr, "Now at end of input.\n");
2483 yychar1 = YYTRANSLATE(yychar);
2488 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2489 /* Give the individual parser a way to print the precise meaning
2490 of a token, for further debugging info. */
2492 YYPRINT (stderr, yychar, yylval);
2494 fprintf (stderr, ")\n");
2500 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2505 /* yyn is what to do for this token type in this state.
2506 Negative => reduce, -yyn is rule number.
2507 Positive => shift, yyn is new state.
2508 New state is final state => don't bother to shift,
2509 just return success.
2510 0, or most negative number => error. */
2525 /* Shift the lookahead token. */
2529 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2532 /* Discard the token being shifted unless it is eof. */
2533 if (yychar != YYEOF)
2541 /* count tokens shifted since error; after three, turn off error status. */
2542 if (yyerrstatus) yyerrstatus--;
2547 /* Do the default action for the current state. */
2550 yyn = yydefact[yystate];
2554 /* Do a reduction. yyn is the number of a rule to reduce with. */
2558 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2565 fprintf (stderr, "Reducing via rule %d (line %d), ",
2568 /* Print the symbols being reduced, and their result. */
2569 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2570 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2571 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2579 #line 1113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2580 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2583 #line 1113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2584 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2587 #line 1114 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2588 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2591 #line 1114 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2592 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2595 #line 1115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2596 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2599 #line 1115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2600 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2603 #line 1116 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2604 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2607 #line 1116 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2608 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2611 #line 1117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2612 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2615 #line 1117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2616 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2619 #line 1121 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2620 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2623 #line 1121 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2624 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2627 #line 1122 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2628 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2631 #line 1122 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2632 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2635 #line 1123 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2636 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2639 #line 1123 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2640 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2643 #line 1124 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2644 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2647 #line 1124 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2648 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2651 #line 1125 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2652 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2655 #line 1125 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2656 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2659 #line 1126 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2660 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2663 #line 1126 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2664 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2667 #line 1127 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2668 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2671 #line 1127 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2672 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2675 #line 1128 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2676 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2679 #line 1129 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2680 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2683 #line 1138 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2684 { yyval.StrVal = 0; ;
2687 #line 1142 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2689 yyval.StrVal = yyvsp[-1].StrVal;
2694 #line 1146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2701 #line 1154 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2708 #line 1159 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2710 yyval.StrVal = yyvsp[-1].StrVal;
2715 #line 1165 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2716 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2719 #line 1166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2720 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2723 #line 1167 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2724 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2727 #line 1168 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2728 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2731 #line 1169 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2732 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2735 #line 1173 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2736 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2739 #line 1174 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2740 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2743 #line 1175 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2744 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2747 #line 1179 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2748 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2751 #line 1180 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2752 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2755 #line 1181 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2756 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2759 #line 1182 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2760 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2763 #line 1186 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2764 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2767 #line 1187 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2768 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2771 #line 1188 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2772 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2775 #line 1192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2776 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2779 #line 1193 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2780 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2783 #line 1194 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2784 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2787 #line 1195 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2788 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2791 #line 1196 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2792 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2795 #line 1200 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2796 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2799 #line 1201 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2800 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2803 #line 1202 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2804 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2807 #line 1205 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2808 { yyval.UIntVal = CallingConv::C; ;
2811 #line 1206 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2812 { yyval.UIntVal = CallingConv::C; ;
2815 #line 1207 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2816 { yyval.UIntVal = CallingConv::Fast; ;
2819 #line 1208 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2820 { yyval.UIntVal = CallingConv::Cold; ;
2823 #line 1209 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2824 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2827 #line 1210 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2828 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2831 #line 1211 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2833 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2834 GEN_ERROR("Calling conv too large");
2835 yyval.UIntVal = yyvsp[0].UInt64Val;
2840 #line 1218 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2841 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2844 #line 1219 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2845 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2848 #line 1220 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2849 { yyval.ParamAttrs = ParamAttr::SExt; ;
2852 #line 1221 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2853 { yyval.ParamAttrs = ParamAttr::SExt; ;
2856 #line 1222 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2857 { yyval.ParamAttrs = ParamAttr::InReg; ;
2860 #line 1223 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2861 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2864 #line 1224 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2865 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2868 #line 1225 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2869 { yyval.ParamAttrs = ParamAttr::ByVal; ;
2872 #line 1226 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2873 { yyval.ParamAttrs = ParamAttr::Nest; ;
2876 #line 1229 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2877 { yyval.ParamAttrs = ParamAttr::None; ;
2880 #line 1230 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2882 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2886 #line 1235 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2887 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2890 #line 1236 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2891 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2894 #line 1237 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2895 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2898 #line 1238 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2899 { yyval.ParamAttrs = ParamAttr::SExt; ;
2902 #line 1239 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2903 { yyval.ParamAttrs = ParamAttr::ReadNone; ;
2906 #line 1240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2907 { yyval.ParamAttrs = ParamAttr::ReadOnly; ;
2910 #line 1243 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2911 { yyval.ParamAttrs = ParamAttr::None; ;
2914 #line 1244 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2916 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2920 #line 1249 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2921 { yyval.StrVal = 0; ;
2924 #line 1250 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2926 yyval.StrVal = yyvsp[0].StrVal;
2930 #line 1257 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2931 { yyval.UIntVal = 0; ;
2934 #line 1258 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2936 yyval.UIntVal = yyvsp[0].UInt64Val;
2937 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2938 GEN_ERROR("Alignment must be a power of two");
2943 #line 1264 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2944 { yyval.UIntVal = 0; ;
2947 #line 1265 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2949 yyval.UIntVal = yyvsp[0].UInt64Val;
2950 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2951 GEN_ERROR("Alignment must be a power of two");
2956 #line 1274 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2958 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2959 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2960 GEN_ERROR("Invalid character in section name");
2961 yyval.StrVal = yyvsp[0].StrVal;
2966 #line 1282 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2967 { yyval.StrVal = 0; ;
2970 #line 1283 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2971 { yyval.StrVal = yyvsp[0].StrVal; ;
2974 #line 1288 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2978 #line 1289 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2982 #line 1290 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2984 CurGV->setSection(*yyvsp[0].StrVal);
2985 delete yyvsp[0].StrVal;
2990 #line 1295 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2992 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2993 GEN_ERROR("Alignment must be a power of two");
2994 CurGV->setAlignment(yyvsp[0].UInt64Val);
2999 #line 1311 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3001 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
3006 #line 1315 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3008 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
3013 #line 1319 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3015 if (*yyvsp[-1].TypeVal == Type::LabelTy)
3016 GEN_ERROR("Cannot form a pointer to a basic block");
3017 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
3018 delete yyvsp[-1].TypeVal;
3023 #line 1326 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3025 if (*yyvsp[-5].TypeVal == Type::LabelTy)
3026 GEN_ERROR("Cannot form a pointer to a basic block");
3027 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-5].TypeVal, yyvsp[-2].UInt64Val)));
3028 delete yyvsp[-5].TypeVal;
3033 #line 1333 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3034 { // Named types are also simple types...
3035 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
3037 yyval.TypeVal = new PATypeHolder(tmp);
3041 #line 1338 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3042 { // Type UpReference
3043 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
3044 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3045 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3046 yyval.TypeVal = new PATypeHolder(OT);
3047 UR_OUT("New Upreference!\n");
3052 #line 1346 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3054 // Allow but ignore attributes on function types; this permits auto-upgrade.
3055 // FIXME: remove in LLVM 3.0.
3056 const Type* RetTy = *yyvsp[-4].TypeVal;
3057 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
3058 isa<OpaqueType>(RetTy)))
3059 GEN_ERROR("LLVM Functions cannot return aggregates");
3061 std::vector<const Type*> Params;
3062 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3063 for (; I != E; ++I ) {
3064 const Type *Ty = I->Ty->get();
3065 Params.push_back(Ty);
3068 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3069 if (isVarArg) Params.pop_back();
3071 for (unsigned i = 0; i != Params.size(); ++i)
3072 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
3073 GEN_ERROR("Function arguments must be value types!");
3077 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
3078 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3079 delete yyvsp[-4].TypeVal; // Delete the return type handle
3080 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3085 #line 1376 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3087 // Allow but ignore attributes on function types; this permits auto-upgrade.
3088 // FIXME: remove in LLVM 3.0.
3089 std::vector<const Type*> Params;
3090 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3091 for ( ; I != E; ++I ) {
3092 const Type* Ty = I->Ty->get();
3093 Params.push_back(Ty);
3096 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3097 if (isVarArg) Params.pop_back();
3099 for (unsigned i = 0; i != Params.size(); ++i)
3100 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
3101 GEN_ERROR("Function arguments must be value types!");
3105 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg);
3106 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3107 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3112 #line 1401 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3113 { // Sized array type?
3114 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3115 delete yyvsp[-1].TypeVal;
3120 #line 1406 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3122 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3123 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3124 GEN_ERROR("Unsigned result not equal to signed result");
3125 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3126 GEN_ERROR("Element type of a VectorType must be primitive");
3127 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3128 delete yyvsp[-1].TypeVal;
3133 #line 1416 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3134 { // Structure type?
3135 std::vector<const Type*> Elements;
3136 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3137 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3138 Elements.push_back(*I);
3140 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3141 delete yyvsp[-1].TypeList;
3146 #line 1426 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3147 { // Empty structure type?
3148 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3153 #line 1430 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3155 std::vector<const Type*> Elements;
3156 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3157 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3158 Elements.push_back(*I);
3160 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3161 delete yyvsp[-2].TypeList;
3166 #line 1440 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3167 { // Empty structure type?
3168 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3173 #line 1447 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3175 // Allow but ignore attributes on function types; this permits auto-upgrade.
3176 // FIXME: remove in LLVM 3.0.
3177 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3178 yyval.TypeWithAttrs.Attrs = ParamAttr::None;
3182 #line 1456 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3184 if (!UpRefs.empty())
3185 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3186 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3187 GEN_ERROR("LLVM functions cannot return aggregate types");
3188 yyval.TypeVal = yyvsp[0].TypeVal;
3192 #line 1463 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3194 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3198 #line 1468 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3200 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3201 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3206 #line 1473 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3208 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3213 #line 1481 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3215 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3216 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3217 TWA.Ty = new PATypeHolder(Type::VoidTy);
3218 yyval.TypeWithAttrsList->push_back(TWA);
3223 #line 1488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3225 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3226 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3227 TWA.Ty = new PATypeHolder(Type::VoidTy);
3228 yyval.TypeWithAttrsList->push_back(TWA);
3233 #line 1495 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3235 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3240 #line 1503 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3242 yyval.TypeList = new std::list<PATypeHolder>();
3243 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3244 delete yyvsp[0].TypeVal;
3249 #line 1509 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3251 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3252 delete yyvsp[0].TypeVal;
3257 #line 1521 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3258 { // Nonempty unsized arr
3259 if (!UpRefs.empty())
3260 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3261 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3263 GEN_ERROR("Cannot make array constant with type: '" +
3264 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3265 const Type *ETy = ATy->getElementType();
3266 int NumElements = ATy->getNumElements();
3268 // Verify that we have the correct size...
3269 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3270 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3271 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3272 itostr(NumElements) + "");
3274 // Verify all elements are correct type!
3275 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3276 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3277 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3278 ETy->getDescription() +"' as required!\nIt is of type '"+
3279 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3282 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3283 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3288 #line 1549 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3290 if (!UpRefs.empty())
3291 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3292 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3294 GEN_ERROR("Cannot make array constant with type: '" +
3295 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3297 int NumElements = ATy->getNumElements();
3298 if (NumElements != -1 && NumElements != 0)
3299 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3300 " arguments, but has size of " + itostr(NumElements) +"");
3301 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3302 delete yyvsp[-2].TypeVal;
3307 #line 1565 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3309 if (!UpRefs.empty())
3310 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3311 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3313 GEN_ERROR("Cannot make array constant with type: '" +
3314 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3316 int NumElements = ATy->getNumElements();
3317 const Type *ETy = ATy->getElementType();
3318 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3319 GEN_ERROR("Can't build string constant of size " +
3320 itostr((int)(yyvsp[0].StrVal->length())) +
3321 " when array has size " + itostr(NumElements) + "");
3322 std::vector<Constant*> Vals;
3323 if (ETy == Type::Int8Ty) {
3324 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3325 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3327 delete yyvsp[0].StrVal;
3328 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3330 delete yyvsp[0].StrVal;
3331 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3332 delete yyvsp[-2].TypeVal;
3337 #line 1592 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3338 { // Nonempty unsized arr
3339 if (!UpRefs.empty())
3340 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3341 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3343 GEN_ERROR("Cannot make packed constant with type: '" +
3344 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3345 const Type *ETy = PTy->getElementType();
3346 int NumElements = PTy->getNumElements();
3348 // Verify that we have the correct size...
3349 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3350 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3351 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3352 itostr(NumElements) + "");
3354 // Verify all elements are correct type!
3355 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3356 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3357 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3358 ETy->getDescription() +"' as required!\nIt is of type '"+
3359 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3362 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3363 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3368 #line 1620 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3370 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3372 GEN_ERROR("Cannot make struct constant with type: '" +
3373 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3375 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3376 GEN_ERROR("Illegal number of initializers for structure type");
3378 // Check to ensure that constants are compatible with the type initializer!
3379 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3380 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3381 GEN_ERROR("Expected type '" +
3382 STy->getElementType(i)->getDescription() +
3383 "' for element #" + utostr(i) +
3384 " of structure initializer");
3386 // Check to ensure that Type is not packed
3387 if (STy->isPacked())
3388 GEN_ERROR("Unpacked Initializer to vector type '" +
3389 STy->getDescription() + "'");
3391 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3392 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3397 #line 1646 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3399 if (!UpRefs.empty())
3400 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3401 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3403 GEN_ERROR("Cannot make struct constant with type: '" +
3404 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3406 if (STy->getNumContainedTypes() != 0)
3407 GEN_ERROR("Illegal number of initializers for structure type");
3409 // Check to ensure that Type is not packed
3410 if (STy->isPacked())
3411 GEN_ERROR("Unpacked Initializer to vector type '" +
3412 STy->getDescription() + "'");
3414 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3415 delete yyvsp[-2].TypeVal;
3420 #line 1666 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3422 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3424 GEN_ERROR("Cannot make struct constant with type: '" +
3425 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3427 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3428 GEN_ERROR("Illegal number of initializers for structure type");
3430 // Check to ensure that constants are compatible with the type initializer!
3431 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3432 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3433 GEN_ERROR("Expected type '" +
3434 STy->getElementType(i)->getDescription() +
3435 "' for element #" + utostr(i) +
3436 " of structure initializer");
3438 // Check to ensure that Type is packed
3439 if (!STy->isPacked())
3440 GEN_ERROR("Vector initializer to non-vector type '" +
3441 STy->getDescription() + "'");
3443 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3444 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3449 #line 1692 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3451 if (!UpRefs.empty())
3452 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3453 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3455 GEN_ERROR("Cannot make struct constant with type: '" +
3456 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3458 if (STy->getNumContainedTypes() != 0)
3459 GEN_ERROR("Illegal number of initializers for structure type");
3461 // Check to ensure that Type is packed
3462 if (!STy->isPacked())
3463 GEN_ERROR("Vector initializer to non-vector type '" +
3464 STy->getDescription() + "'");
3466 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3467 delete yyvsp[-4].TypeVal;
3472 #line 1712 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3474 if (!UpRefs.empty())
3475 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3476 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3478 GEN_ERROR("Cannot make null pointer constant with type: '" +
3479 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3481 yyval.ConstVal = ConstantPointerNull::get(PTy);
3482 delete yyvsp[-1].TypeVal;
3487 #line 1724 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3489 if (!UpRefs.empty())
3490 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3491 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3492 delete yyvsp[-1].TypeVal;
3497 #line 1731 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3499 if (!UpRefs.empty())
3500 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3501 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3503 GEN_ERROR("Global const reference must be a pointer type");
3505 // ConstExprs can exist in the body of a function, thus creating
3506 // GlobalValues whenever they refer to a variable. Because we are in
3507 // the context of a function, getExistingVal will search the functions
3508 // symbol table instead of the module symbol table for the global symbol,
3509 // which throws things all off. To get around this, we just tell
3510 // getExistingVal that we are at global scope here.
3512 Function *SavedCurFn = CurFun.CurrentFunction;
3513 CurFun.CurrentFunction = 0;
3515 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3518 CurFun.CurrentFunction = SavedCurFn;
3520 // If this is an initializer for a constant pointer, which is referencing a
3521 // (currently) undefined variable, create a stub now that shall be replaced
3522 // in the future with the right type of variable.
3525 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3526 const PointerType *PT = cast<PointerType>(Ty);
3528 // First check to see if the forward references value is already created!
3529 PerModuleInfo::GlobalRefsType::iterator I =
3530 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3532 if (I != CurModule.GlobalRefs.end()) {
3533 V = I->second; // Placeholder already exists, use it...
3534 yyvsp[0].ValIDVal.destroy();
3537 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3538 Name = yyvsp[0].ValIDVal.getName();
3539 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3540 GEN_ERROR("Invalid reference to global");
3542 // Create the forward referenced global.
3544 if (const FunctionType *FTy =
3545 dyn_cast<FunctionType>(PT->getElementType())) {
3546 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3547 CurModule.CurrentModule);
3549 GV = new GlobalVariable(PT->getElementType(), false,
3550 GlobalValue::ExternalWeakLinkage, 0,
3551 Name, CurModule.CurrentModule);
3554 // Keep track of the fact that we have a forward ref to recycle it
3555 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3560 yyval.ConstVal = cast<GlobalValue>(V);
3561 delete yyvsp[-1].TypeVal; // Free the type handle
3566 #line 1797 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3568 if (!UpRefs.empty())
3569 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3570 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3571 GEN_ERROR("Mismatched types for constant expression: " +
3572 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3573 yyval.ConstVal = yyvsp[0].ConstVal;
3574 delete yyvsp[-1].TypeVal;
3579 #line 1807 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3581 if (!UpRefs.empty())
3582 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3583 const Type *Ty = yyvsp[-1].TypeVal->get();
3584 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3585 GEN_ERROR("Cannot create a null initialized value of this type");
3586 yyval.ConstVal = Constant::getNullValue(Ty);
3587 delete yyvsp[-1].TypeVal;
3592 #line 1817 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3593 { // integral constants
3594 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3595 GEN_ERROR("Constant value doesn't fit in type");
3596 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3601 #line 1823 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3602 { // arbitrary precision integer constants
3603 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3604 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3605 GEN_ERROR("Constant value does not fit in type");
3607 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3608 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3609 delete yyvsp[0].APIntVal;
3614 #line 1833 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3615 { // integral constants
3616 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3617 GEN_ERROR("Constant value doesn't fit in type");
3618 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3623 #line 1839 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3624 { // arbitrary precision integer constants
3625 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3626 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3627 GEN_ERROR("Constant value does not fit in type");
3629 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3630 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3631 delete yyvsp[0].APIntVal;
3636 #line 1849 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3637 { // Boolean constants
3638 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3639 yyval.ConstVal = ConstantInt::getTrue();
3644 #line 1854 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3645 { // Boolean constants
3646 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3647 yyval.ConstVal = ConstantInt::getFalse();
3652 #line 1859 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3653 { // Floating point constants
3654 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
3655 GEN_ERROR("Floating point constant invalid for type");
3656 // Lexer has no type info, so builds all float and double FP constants
3657 // as double. Fix this here. Long double is done right.
3658 if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy)
3659 yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
3660 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
3661 delete yyvsp[0].FPVal;
3666 #line 1872 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3668 if (!UpRefs.empty())
3669 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3670 Constant *Val = yyvsp[-3].ConstVal;
3671 const Type *DestTy = yyvsp[-1].TypeVal->get();
3672 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3673 GEN_ERROR("invalid cast opcode for cast from '" +
3674 Val->getType()->getDescription() + "' to '" +
3675 DestTy->getDescription() + "'");
3676 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3677 delete yyvsp[-1].TypeVal;
3681 #line 1884 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3683 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3684 GEN_ERROR("GetElementPtr requires a pointer operand");
3687 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
3690 GEN_ERROR("Index list invalid for constant getelementptr");
3692 SmallVector<Constant*, 8> IdxVec;
3693 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3694 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3695 IdxVec.push_back(C);
3697 GEN_ERROR("Indices to constant getelementptr must be constants");
3699 delete yyvsp[-1].ValueList;
3701 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3706 #line 1906 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3708 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3709 GEN_ERROR("Select condition must be of boolean type");
3710 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3711 GEN_ERROR("Select operand types must match");
3712 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3717 #line 1914 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3719 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3720 GEN_ERROR("Binary operator types must match");
3722 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3726 #line 1920 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3728 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3729 GEN_ERROR("Logical operator types must match");
3730 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3731 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3732 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3733 GEN_ERROR("Logical operator requires integral operands");
3735 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3740 #line 1931 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3742 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3743 GEN_ERROR("icmp operand types must match");
3744 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3748 #line 1936 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3750 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3751 GEN_ERROR("fcmp operand types must match");
3752 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3756 #line 1941 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3758 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3759 GEN_ERROR("Invalid extractelement operands");
3760 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3765 #line 1947 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3767 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3768 GEN_ERROR("Invalid insertelement operands");
3769 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3774 #line 1953 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3776 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3777 GEN_ERROR("Invalid shufflevector operands");
3778 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3783 #line 1962 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3785 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3790 #line 1966 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3792 yyval.ConstVector = new std::vector<Constant*>();
3793 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3798 #line 1974 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3799 { yyval.BoolVal = false; ;
3802 #line 1974 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3803 { yyval.BoolVal = true; ;
3806 #line 1977 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3807 { yyval.BoolVal = true; ;
3810 #line 1977 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3811 { yyval.BoolVal = false; ;
3814 #line 1980 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3816 const Type* VTy = yyvsp[-1].TypeVal->get();
3817 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3819 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3821 GEN_ERROR("Aliases can be created only to global values");
3823 yyval.ConstVal = Aliasee;
3825 delete yyvsp[-1].TypeVal;
3829 #line 1992 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3831 Constant *Val = yyvsp[-3].ConstVal;
3832 const Type *DestTy = yyvsp[-1].TypeVal->get();
3833 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3834 GEN_ERROR("invalid cast opcode for cast from '" +
3835 Val->getType()->getDescription() + "' to '" +
3836 DestTy->getDescription() + "'");
3838 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3840 delete yyvsp[-1].TypeVal;
3844 #line 2013 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3846 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3847 CurModule.ModuleDone();
3852 #line 2018 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3854 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3855 CurModule.ModuleDone();
3860 #line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3861 { CurFun.isDeclare = false; ;
3864 #line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3866 CurFun.FunctionDone();
3871 #line 2035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3872 { CurFun.isDeclare = true; ;
3875 #line 2035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3881 #line 2038 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3887 #line 2041 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3889 if (!UpRefs.empty())
3890 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3891 // Eagerly resolve types. This is not an optimization, this is a
3892 // requirement that is due to the fact that we could have this:
3894 // %list = type { %list * }
3895 // %list = type { %list * } ; repeated type decl
3897 // If types are not resolved eagerly, then the two types will not be
3898 // determined to be the same type!
3900 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3902 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3904 // If this is a named type that is not a redefinition, add it to the slot
3906 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3909 delete yyvsp[0].TypeVal;
3914 #line 2065 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3916 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3918 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3920 // If this is a named type that is not a redefinition, add it to the slot
3922 CurModule.Types.push_back(yyvsp[0].PrimType);
3928 #line 2076 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3930 /* "Externally Visible" Linkage */
3931 if (yyvsp[0].ConstVal == 0)
3932 GEN_ERROR("Global value initializer is not a constant");
3933 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3934 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3939 #line 2083 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3945 #line 2087 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3947 /* "Externally Visible" Linkage with address space qualifier */
3948 if (yyvsp[-4].ConstVal == 0)
3949 GEN_ERROR("Global value initializer is not a constant");
3950 CurGV = ParseGlobalVariable(yyvsp[-8].StrVal, GlobalValue::ExternalLinkage,
3951 yyvsp[-7].Visibility, yyvsp[-5].BoolVal, yyvsp[-4].ConstVal->getType(), yyvsp[-4].ConstVal, yyvsp[-6].BoolVal, yyvsp[-1].UInt64Val);
3956 #line 2094 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3962 #line 2098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3964 if (yyvsp[0].ConstVal == 0)
3965 GEN_ERROR("Global value initializer is not a constant");
3966 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3971 #line 2103 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3977 #line 2107 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3979 if (!UpRefs.empty())
3980 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3981 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
3983 delete yyvsp[0].TypeVal;
3987 #line 2113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3994 #line 2117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3997 if (yyvsp[-4].StrVal) {
3998 Name = *yyvsp[-4].StrVal;
3999 delete yyvsp[-4].StrVal;
4002 GEN_ERROR("Alias name cannot be empty");
4004 Constant* Aliasee = yyvsp[0].ConstVal;
4006 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4008 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
4009 CurModule.CurrentModule);
4010 GA->setVisibility(yyvsp[-3].Visibility);
4011 InsertValue(GA, CurModule.Values);
4014 // If there was a forward reference of this alias, resolve it now.
4018 ID = ValID::createGlobalName(Name);
4020 ID = ValID::createGlobalID(CurModule.Values.size()-1);
4022 if (GlobalValue *FWGV =
4023 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
4024 // Replace uses of the fwdref with the actual alias.
4025 FWGV->replaceAllUsesWith(GA);
4026 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
4027 GV->eraseFromParent();
4029 cast<Function>(FWGV)->eraseFromParent();
4037 #line 2157 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4043 #line 2160 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4049 #line 2166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4051 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4052 if (AsmSoFar.empty())
4053 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
4055 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
4056 delete yyvsp[0].StrVal;
4061 #line 2176 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4063 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
4064 delete yyvsp[0].StrVal;
4068 #line 2180 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4070 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
4071 delete yyvsp[0].StrVal;
4075 #line 2187 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4077 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4078 delete yyvsp[0].StrVal;
4083 #line 2192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4085 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4086 delete yyvsp[0].StrVal;
4091 #line 2197 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4097 #line 2206 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4099 if (!UpRefs.empty())
4100 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4101 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4102 GEN_ERROR("void typed arguments are invalid");
4103 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4104 yyval.ArgList = yyvsp[-4].ArgList;
4105 yyvsp[-4].ArgList->push_back(E);
4110 #line 2216 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4112 if (!UpRefs.empty())
4113 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4114 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4115 GEN_ERROR("void typed arguments are invalid");
4116 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4117 yyval.ArgList = new ArgListType;
4118 yyval.ArgList->push_back(E);
4123 #line 2227 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4125 yyval.ArgList = yyvsp[0].ArgList;
4130 #line 2231 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4132 yyval.ArgList = yyvsp[-2].ArgList;
4133 struct ArgListEntry E;
4134 E.Ty = new PATypeHolder(Type::VoidTy);
4136 E.Attrs = ParamAttr::None;
4137 yyval.ArgList->push_back(E);
4142 #line 2240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4144 yyval.ArgList = new ArgListType;
4145 struct ArgListEntry E;
4146 E.Ty = new PATypeHolder(Type::VoidTy);
4148 E.Attrs = ParamAttr::None;
4149 yyval.ArgList->push_back(E);
4154 #line 2249 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4161 #line 2255 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4163 std::string FunctionName(*yyvsp[-7].StrVal);
4164 delete yyvsp[-7].StrVal; // Free strdup'd memory!
4166 // Check the function result for abstractness if this is a define. We should
4167 // have no abstract types at this point
4168 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-8].TypeVal))
4169 GEN_ERROR("Reference to abstract result: "+ yyvsp[-8].TypeVal->get()->getDescription());
4171 std::vector<const Type*> ParamTypeList;
4172 ParamAttrsVector Attrs;
4173 if (yyvsp[-3].ParamAttrs != ParamAttr::None) {
4174 ParamAttrsWithIndex PAWI;
4176 PAWI.attrs = yyvsp[-3].ParamAttrs;
4177 Attrs.push_back(PAWI);
4179 if (yyvsp[-5].ArgList) { // If there are arguments...
4181 for (ArgListType::iterator I = yyvsp[-5].ArgList->begin(); I != yyvsp[-5].ArgList->end(); ++I, ++index) {
4182 const Type* Ty = I->Ty->get();
4183 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4184 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4185 ParamTypeList.push_back(Ty);
4186 if (Ty != Type::VoidTy)
4187 if (I->Attrs != ParamAttr::None) {
4188 ParamAttrsWithIndex PAWI;
4190 PAWI.attrs = I->Attrs;
4191 Attrs.push_back(PAWI);
4196 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4197 if (isVarArg) ParamTypeList.pop_back();
4199 const ParamAttrsList *PAL = 0;
4201 PAL = ParamAttrsList::get(Attrs);
4203 FunctionType *FT = FunctionType::get(*yyvsp[-8].TypeVal, ParamTypeList, isVarArg);
4204 const PointerType *PFT = PointerType::get(FT);
4205 delete yyvsp[-8].TypeVal;
4208 if (!FunctionName.empty()) {
4209 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4211 ID = ValID::createGlobalID(CurModule.Values.size());
4215 // See if this function was forward referenced. If so, recycle the object.
4216 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4217 // Move the function to the end of the list, from whereever it was
4218 // previously inserted.
4219 Fn = cast<Function>(FWRef);
4220 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
4221 CurModule.CurrentModule->getFunctionList().remove(Fn);
4222 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4223 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4224 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4225 if (Fn->getFunctionType() != FT ) {
4226 // The existing function doesn't have the same type. This is an overload
4228 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4229 } else if (Fn->getParamAttrs() != PAL) {
4230 // The existing function doesn't have the same parameter attributes.
4231 // This is an overload error.
4232 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4233 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4234 // Neither the existing or the current function is a declaration and they
4235 // have the same name and same type. Clearly this is a redefinition.
4236 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4237 } else if (Fn->isDeclaration()) {
4238 // Make sure to strip off any argument names so we can't get conflicts.
4239 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4243 } else { // Not already defined?
4244 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4245 CurModule.CurrentModule);
4246 InsertValue(Fn, CurModule.Values);
4249 CurFun.FunctionStart(Fn);
4251 if (CurFun.isDeclare) {
4252 // If we have declaration, always overwrite linkage. This will allow us to
4253 // correctly handle cases, when pointer to function is passed as argument to
4254 // another function.
4255 Fn->setLinkage(CurFun.Linkage);
4256 Fn->setVisibility(CurFun.Visibility);
4258 Fn->setCallingConv(yyvsp[-9].UIntVal);
4259 Fn->setParamAttrs(PAL);
4260 Fn->setAlignment(yyvsp[-1].UIntVal);
4261 if (yyvsp[-2].StrVal) {
4262 Fn->setSection(*yyvsp[-2].StrVal);
4263 delete yyvsp[-2].StrVal;
4265 if (yyvsp[0].StrVal) {
4266 Fn->setCollector(yyvsp[0].StrVal->c_str());
4267 delete yyvsp[0].StrVal;
4270 // Add all of the arguments we parsed to the function...
4271 if (yyvsp[-5].ArgList) { // Is null if empty...
4272 if (isVarArg) { // Nuke the last entry
4273 assert(yyvsp[-5].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-5].ArgList->back().Name == 0 &&
4274 "Not a varargs marker!");
4275 delete yyvsp[-5].ArgList->back().Ty;
4276 yyvsp[-5].ArgList->pop_back(); // Delete the last entry
4278 Function::arg_iterator ArgIt = Fn->arg_begin();
4279 Function::arg_iterator ArgEnd = Fn->arg_end();
4281 for (ArgListType::iterator I = yyvsp[-5].ArgList->begin();
4282 I != yyvsp[-5].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4283 delete I->Ty; // Delete the typeholder...
4284 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4290 delete yyvsp[-5].ArgList; // We're now done with the argument list
4296 #line 2390 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4298 yyval.FunctionVal = CurFun.CurrentFunction;
4300 // Make sure that we keep track of the linkage type even if there was a
4301 // previous "declare".
4302 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4303 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4307 #line 2401 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4309 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4314 #line 2406 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4316 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4317 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4318 yyval.FunctionVal = CurFun.CurrentFunction;
4319 CurFun.FunctionDone();
4324 #line 2418 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4326 yyval.BoolVal = false;
4331 #line 2422 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4333 yyval.BoolVal = true;
4338 #line 2427 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4339 { // A reference to a direct constant
4340 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4345 #line 2431 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4347 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4352 #line 2435 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4353 { // Perhaps it's an FP constant?
4354 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4359 #line 2439 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4361 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4366 #line 2443 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4368 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4373 #line 2447 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4375 yyval.ValIDVal = ValID::createNull();
4380 #line 2451 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4382 yyval.ValIDVal = ValID::createUndef();
4387 #line 2455 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4388 { // A vector zero constant.
4389 yyval.ValIDVal = ValID::createZeroInit();
4394 #line 2459 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4395 { // Nonempty unsized packed vector
4396 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4397 int NumElements = yyvsp[-1].ConstVector->size();
4399 VectorType* pt = VectorType::get(ETy, NumElements);
4400 PATypeHolder* PTy = new PATypeHolder(
4408 // Verify all elements are correct type!
4409 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4410 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4411 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4412 ETy->getDescription() +"' as required!\nIt is of type '" +
4413 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4416 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4417 delete PTy; delete yyvsp[-1].ConstVector;
4422 #line 2484 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4424 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4429 #line 2488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4431 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4432 delete yyvsp[-2].StrVal;
4433 delete yyvsp[0].StrVal;
4438 #line 2498 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4439 { // Is it an integer reference...?
4440 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4445 #line 2502 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4447 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4452 #line 2506 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4453 { // Is it a named reference...?
4454 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4455 delete yyvsp[0].StrVal;
4460 #line 2511 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4461 { // Is it a named reference...?
4462 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4463 delete yyvsp[0].StrVal;
4468 #line 2524 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4470 if (!UpRefs.empty())
4471 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4472 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4473 delete yyvsp[-1].TypeVal;
4478 #line 2533 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4480 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4485 #line 2537 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4486 { // Do not allow functions with 0 basic blocks
4487 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4492 #line 2546 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4494 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4496 InsertValue(yyvsp[0].TermInstVal);
4497 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4498 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4503 #line 2555 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4505 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4506 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4507 if (CI2->getParent() == 0)
4508 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4509 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4510 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4515 #line 2564 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4516 { // Empty space between instruction lists
4517 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4522 #line 2568 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4523 { // Labelled (named) basic block
4524 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4525 delete yyvsp[0].StrVal;
4531 #line 2575 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4532 { // Return with a result...
4533 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4538 #line 2579 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4539 { // Return with no result...
4540 yyval.TermInstVal = new ReturnInst();
4545 #line 2583 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4546 { // Unconditional Branch...
4547 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4549 yyval.TermInstVal = new BranchInst(tmpBB);
4553 #line 2588 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4555 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4556 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4558 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4560 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4562 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4566 #line 2598 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4568 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4570 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4572 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4573 yyval.TermInstVal = S;
4575 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4576 E = yyvsp[-1].JumpTable->end();
4577 for (; I != E; ++I) {
4578 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4579 S->addCase(CI, I->second);
4581 GEN_ERROR("Switch case is constant, but not a simple integer");
4583 delete yyvsp[-1].JumpTable;
4588 #line 2617 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4590 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4592 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4594 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4595 yyval.TermInstVal = S;
4600 #line 2627 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4603 // Handle the short syntax
4604 const PointerType *PFTy = 0;
4605 const FunctionType *Ty = 0;
4606 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4607 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4608 // Pull out the types of all of the arguments...
4609 std::vector<const Type*> ParamTypes;
4610 ParamList::iterator I = yyvsp[-8].ParamList->begin(), E = yyvsp[-8].ParamList->end();
4611 for (; I != E; ++I) {
4612 const Type *Ty = I->Val->getType();
4613 if (Ty == Type::VoidTy)
4614 GEN_ERROR("Short call syntax cannot be used with varargs");
4615 ParamTypes.push_back(Ty);
4617 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false);
4618 PFTy = PointerType::get(Ty);
4621 delete yyvsp[-11].TypeVal;
4623 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4625 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4627 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4630 ParamAttrsVector Attrs;
4631 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4632 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4633 Attrs.push_back(PAWI);
4636 // Check the arguments
4638 if (yyvsp[-8].ParamList->empty()) { // Has no arguments?
4639 // Make sure no arguments is a good thing!
4640 if (Ty->getNumParams() != 0)
4641 GEN_ERROR("No arguments passed to a function that "
4642 "expects arguments");
4643 } else { // Has arguments?
4644 // Loop through FunctionType's arguments and ensure they are specified
4646 FunctionType::param_iterator I = Ty->param_begin();
4647 FunctionType::param_iterator E = Ty->param_end();
4648 ParamList::iterator ArgI = yyvsp[-8].ParamList->begin(), ArgE = yyvsp[-8].ParamList->end();
4651 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
4652 if (ArgI->Val->getType() != *I)
4653 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4654 (*I)->getDescription() + "'");
4655 Args.push_back(ArgI->Val);
4656 if (ArgI->Attrs != ParamAttr::None) {
4657 ParamAttrsWithIndex PAWI;
4659 PAWI.attrs = ArgI->Attrs;
4660 Attrs.push_back(PAWI);
4664 if (Ty->isVarArg()) {
4666 for (; ArgI != ArgE; ++ArgI)
4667 Args.push_back(ArgI->Val); // push the remaining varargs
4668 } else if (I != E || ArgI != ArgE)
4669 GEN_ERROR("Invalid number of parameters detected");
4672 const ParamAttrsList *PAL = 0;
4674 PAL = ParamAttrsList::get(Attrs);
4676 // Create the InvokeInst
4677 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
4678 II->setCallingConv(yyvsp[-12].UIntVal);
4679 II->setParamAttrs(PAL);
4680 yyval.TermInstVal = II;
4681 delete yyvsp[-8].ParamList;
4686 #line 2710 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4688 yyval.TermInstVal = new UnwindInst();
4693 #line 2714 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4695 yyval.TermInstVal = new UnreachableInst();
4700 #line 2721 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4702 yyval.JumpTable = yyvsp[-5].JumpTable;
4703 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4706 GEN_ERROR("May only switch on a constant pool value");
4708 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4710 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4714 #line 2732 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4716 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4717 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4721 GEN_ERROR("May only switch on a constant pool value");
4723 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4725 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4729 #line 2745 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4731 // Is this definition named?? if so, assign the name...
4732 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4734 InsertValue(yyvsp[0].InstVal);
4735 yyval.InstVal = yyvsp[0].InstVal;
4740 #line 2755 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4741 { // Used for PHI nodes
4742 if (!UpRefs.empty())
4743 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4744 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4745 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4747 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4749 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4750 delete yyvsp[-5].TypeVal;
4754 #line 2766 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4756 yyval.PHIList = yyvsp[-6].PHIList;
4757 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4759 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4761 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4765 #line 2776 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4767 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4768 if (!UpRefs.empty())
4769 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4770 // Used for call and invoke instructions
4771 yyval.ParamList = new ParamList();
4772 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal);
4773 yyval.ParamList->push_back(E);
4774 delete yyvsp[-3].TypeVal;
4779 #line 2787 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4781 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4782 // Labels are only valid in ASMs
4783 yyval.ParamList = new ParamList();
4784 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4785 yyval.ParamList->push_back(E);
4790 #line 2795 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4792 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4793 if (!UpRefs.empty())
4794 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4795 yyval.ParamList = yyvsp[-5].ParamList;
4796 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal);
4797 yyval.ParamList->push_back(E);
4798 delete yyvsp[-3].TypeVal;
4803 #line 2805 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4805 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4806 yyval.ParamList = yyvsp[-5].ParamList;
4807 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4808 yyval.ParamList->push_back(E);
4813 #line 2812 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4814 { yyval.ParamList = new ParamList(); ;
4817 #line 2815 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4818 { yyval.ValueList = new std::vector<Value*>(); ;
4821 #line 2816 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4823 yyval.ValueList = yyvsp[-2].ValueList;
4824 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4829 #line 2823 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4831 yyval.BoolVal = true;
4836 #line 2827 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4838 yyval.BoolVal = false;
4843 #line 2832 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4845 if (!UpRefs.empty())
4846 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4847 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4848 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4850 "Arithmetic operator requires integer, FP, or packed operands");
4851 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4853 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4855 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4856 if (yyval.InstVal == 0)
4857 GEN_ERROR("binary operator returned null");
4858 delete yyvsp[-3].TypeVal;
4862 #line 2848 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4864 if (!UpRefs.empty())
4865 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4866 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4867 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4868 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4869 GEN_ERROR("Logical operator requires integral operands");
4871 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4873 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4875 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4876 if (yyval.InstVal == 0)
4877 GEN_ERROR("binary operator returned null");
4878 delete yyvsp[-3].TypeVal;
4882 #line 2865 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4884 if (!UpRefs.empty())
4885 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4886 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4887 GEN_ERROR("Vector types not supported by icmp instruction");
4888 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4890 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4892 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4893 if (yyval.InstVal == 0)
4894 GEN_ERROR("icmp operator returned null");
4895 delete yyvsp[-3].TypeVal;
4899 #line 2879 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4901 if (!UpRefs.empty())
4902 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4903 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4904 GEN_ERROR("Vector types not supported by fcmp instruction");
4905 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4907 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4909 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4910 if (yyval.InstVal == 0)
4911 GEN_ERROR("fcmp operator returned null");
4912 delete yyvsp[-3].TypeVal;
4916 #line 2893 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4918 if (!UpRefs.empty())
4919 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4920 Value* Val = yyvsp[-2].ValueVal;
4921 const Type* DestTy = yyvsp[0].TypeVal->get();
4922 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4923 GEN_ERROR("invalid cast opcode for cast from '" +
4924 Val->getType()->getDescription() + "' to '" +
4925 DestTy->getDescription() + "'");
4926 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4927 delete yyvsp[0].TypeVal;
4931 #line 2905 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4933 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4934 GEN_ERROR("select condition must be boolean");
4935 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4936 GEN_ERROR("select value types should match");
4937 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4942 #line 2913 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4944 if (!UpRefs.empty())
4945 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4946 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4947 delete yyvsp[0].TypeVal;
4952 #line 2920 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4954 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4955 GEN_ERROR("Invalid extractelement operands");
4956 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4961 #line 2926 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4963 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4964 GEN_ERROR("Invalid insertelement operands");
4965 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4970 #line 2932 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4972 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4973 GEN_ERROR("Invalid shufflevector operands");
4974 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4979 #line 2938 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4981 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4982 if (!Ty->isFirstClassType())
4983 GEN_ERROR("PHI node operands must be of first class type");
4984 yyval.InstVal = new PHINode(Ty);
4985 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4986 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4987 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4988 GEN_ERROR("All elements of a PHI node must be of the same type");
4989 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4990 yyvsp[0].PHIList->pop_front();
4992 delete yyvsp[0].PHIList; // Free the list...
4997 #line 2954 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5000 // Handle the short syntax
5001 const PointerType *PFTy = 0;
5002 const FunctionType *Ty = 0;
5003 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
5004 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5005 // Pull out the types of all of the arguments...
5006 std::vector<const Type*> ParamTypes;
5007 ParamList::iterator I = yyvsp[-2].ParamList->begin(), E = yyvsp[-2].ParamList->end();
5008 for (; I != E; ++I) {
5009 const Type *Ty = I->Val->getType();
5010 if (Ty == Type::VoidTy)
5011 GEN_ERROR("Short call syntax cannot be used with varargs");
5012 ParamTypes.push_back(Ty);
5014 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false);
5015 PFTy = PointerType::get(Ty);
5018 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
5021 // Check for call to invalid intrinsic to avoid crashing later.
5022 if (Function *theF = dyn_cast<Function>(V)) {
5023 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5024 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5025 !theF->getIntrinsicID(true))
5026 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5027 theF->getName() + "'");
5030 // Set up the ParamAttrs for the function
5031 ParamAttrsVector Attrs;
5032 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
5033 ParamAttrsWithIndex PAWI;
5035 PAWI.attrs = yyvsp[0].ParamAttrs;
5036 Attrs.push_back(PAWI);
5038 // Check the arguments
5040 if (yyvsp[-2].ParamList->empty()) { // Has no arguments?
5041 // Make sure no arguments is a good thing!
5042 if (Ty->getNumParams() != 0)
5043 GEN_ERROR("No arguments passed to a function that "
5044 "expects arguments");
5045 } else { // Has arguments?
5046 // Loop through FunctionType's arguments and ensure they are specified
5047 // correctly. Also, gather any parameter attributes.
5048 FunctionType::param_iterator I = Ty->param_begin();
5049 FunctionType::param_iterator E = Ty->param_end();
5050 ParamList::iterator ArgI = yyvsp[-2].ParamList->begin(), ArgE = yyvsp[-2].ParamList->end();
5053 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5054 if (ArgI->Val->getType() != *I)
5055 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5056 (*I)->getDescription() + "'");
5057 Args.push_back(ArgI->Val);
5058 if (ArgI->Attrs != ParamAttr::None) {
5059 ParamAttrsWithIndex PAWI;
5061 PAWI.attrs = ArgI->Attrs;
5062 Attrs.push_back(PAWI);
5065 if (Ty->isVarArg()) {
5067 for (; ArgI != ArgE; ++ArgI)
5068 Args.push_back(ArgI->Val); // push the remaining varargs
5069 } else if (I != E || ArgI != ArgE)
5070 GEN_ERROR("Invalid number of parameters detected");
5073 // Finish off the ParamAttrs and check them
5074 const ParamAttrsList *PAL = 0;
5076 PAL = ParamAttrsList::get(Attrs);
5078 // Create the call node
5079 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
5080 CI->setTailCall(yyvsp[-7].BoolVal);
5081 CI->setCallingConv(yyvsp[-6].UIntVal);
5082 CI->setParamAttrs(PAL);
5084 delete yyvsp[-2].ParamList;
5085 delete yyvsp[-5].TypeVal;
5090 #line 3044 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5092 yyval.InstVal = yyvsp[0].InstVal;
5097 #line 3049 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5099 yyval.BoolVal = true;
5104 #line 3053 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5106 yyval.BoolVal = false;
5111 #line 3060 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5113 if (!UpRefs.empty())
5114 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5115 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5116 delete yyvsp[-1].TypeVal;
5121 #line 3067 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5123 if (!UpRefs.empty())
5124 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5125 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5127 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5128 delete yyvsp[-4].TypeVal;
5132 #line 3075 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5134 if (!UpRefs.empty())
5135 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5136 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5137 delete yyvsp[-1].TypeVal;
5142 #line 3082 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5144 if (!UpRefs.empty())
5145 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5146 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5148 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5149 delete yyvsp[-4].TypeVal;
5153 #line 3090 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5155 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5156 GEN_ERROR("Trying to free nonpointer type " +
5157 yyvsp[0].ValueVal->getType()->getDescription() + "");
5158 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5163 #line 3098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5165 if (!UpRefs.empty())
5166 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5167 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5168 GEN_ERROR("Can't load from nonpointer type: " +
5169 (*yyvsp[-2].TypeVal)->getDescription());
5170 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5171 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5172 (*yyvsp[-2].TypeVal)->getDescription());
5173 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5175 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5176 delete yyvsp[-2].TypeVal;
5180 #line 3112 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5182 if (!UpRefs.empty())
5183 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5184 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5186 GEN_ERROR("Can't store to a nonpointer type: " +
5187 (*yyvsp[-2].TypeVal)->getDescription());
5188 const Type *ElTy = PT->getElementType();
5189 if (ElTy != yyvsp[-4].ValueVal->getType())
5190 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5191 "' into space of type '" + ElTy->getDescription() + "'");
5193 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5195 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5196 delete yyvsp[-2].TypeVal;
5200 #line 3129 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5202 if (!UpRefs.empty())
5203 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5204 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5205 GEN_ERROR("getelementptr insn requires pointer operand");
5207 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
5208 GEN_ERROR("Invalid getelementptr indices for type '" +
5209 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5210 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5212 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
5213 delete yyvsp[-2].TypeVal;
5214 delete yyvsp[0].ValueList;
5218 /* the action file gets copied in in place of this dollarsign */
5219 #line 543 "/usr/share/bison.simple"
5230 short *ssp1 = yyss - 1;
5231 fprintf (stderr, "state stack now");
5232 while (ssp1 != yyssp)
5233 fprintf (stderr, " %d", *++ssp1);
5234 fprintf (stderr, "\n");
5244 yylsp->first_line = yylloc.first_line;
5245 yylsp->first_column = yylloc.first_column;
5246 yylsp->last_line = (yylsp-1)->last_line;
5247 yylsp->last_column = (yylsp-1)->last_column;
5252 yylsp->last_line = (yylsp+yylen-1)->last_line;
5253 yylsp->last_column = (yylsp+yylen-1)->last_column;
5257 /* Now "shift" the result of the reduction.
5258 Determine what state that goes to,
5259 based on the state we popped back to
5260 and the rule number reduced by. */
5264 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5265 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5266 yystate = yytable[yystate];
5268 yystate = yydefgoto[yyn - YYNTBASE];
5272 yyerrlab: /* here on detecting error */
5275 /* If not already recovering from an error, report this error. */
5279 #ifdef YYERROR_VERBOSE
5280 yyn = yypact[yystate];
5282 if (yyn > YYFLAG && yyn < YYLAST)
5289 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5290 for (x = (yyn < 0 ? -yyn : 0);
5291 x < (sizeof(yytname) / sizeof(char *)); x++)
5292 if (yycheck[x + yyn] == x)
5293 size += strlen(yytname[x]) + 15, count++;
5294 msg = (char *) malloc(size + 15);
5297 strcpy(msg, "parse error");
5302 for (x = (yyn < 0 ? -yyn : 0);
5303 x < (sizeof(yytname) / sizeof(char *)); x++)
5304 if (yycheck[x + yyn] == x)
5306 strcat(msg, count == 0 ? ", expecting `" : " or `");
5307 strcat(msg, yytname[x]);
5316 yyerror ("parse error; also virtual memory exceeded");
5319 #endif /* YYERROR_VERBOSE */
5320 yyerror("parse error");
5324 yyerrlab1: /* here on error raised explicitly by an action */
5326 if (yyerrstatus == 3)
5328 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5330 /* return failure if at end of input */
5331 if (yychar == YYEOF)
5336 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5342 /* Else will try to reuse lookahead token
5343 after shifting the error token. */
5345 yyerrstatus = 3; /* Each real token shifted decrements this */
5349 yyerrdefault: /* current state does not do anything special for the error token. */
5352 /* This is wrong; only states that explicitly want error tokens
5353 should shift them. */
5354 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5355 if (yyn) goto yydefault;
5358 yyerrpop: /* pop the current state because it cannot handle the error token */
5360 if (yyssp == yyss) YYABORT;
5370 short *ssp1 = yyss - 1;
5371 fprintf (stderr, "Error: state stack now");
5372 while (ssp1 != yyssp)
5373 fprintf (stderr, " %d", *++ssp1);
5374 fprintf (stderr, "\n");
5380 yyn = yypact[yystate];
5385 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5404 fprintf(stderr, "Shifting error token, ");
5416 /* YYACCEPT comes here. */
5428 /* YYABORT comes here. */
5439 #line 3146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5442 // common code from the two 'RunVMAsmParser' functions
5443 static Module* RunParser(Module * M) {
5444 CurModule.CurrentModule = M;
5445 // Check to make sure the parser succeeded
5448 delete ParserResult;
5452 // Emit an error if there are any unresolved types left.
5453 if (!CurModule.LateResolveTypes.empty()) {
5454 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5455 if (DID.Type == ValID::LocalName) {
5456 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5458 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5461 delete ParserResult;
5465 // Emit an error if there are any unresolved values left.
5466 if (!CurModule.LateResolveValues.empty()) {
5467 Value *V = CurModule.LateResolveValues.back();
5468 std::map<Value*, std::pair<ValID, int> >::iterator I =
5469 CurModule.PlaceHolderInfo.find(V);
5471 if (I != CurModule.PlaceHolderInfo.end()) {
5472 ValID &DID = I->second.first;
5473 if (DID.Type == ValID::LocalName) {
5474 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5476 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5479 delete ParserResult;
5484 // Check to make sure that parsing produced a result
5488 // Reset ParserResult variable while saving its value for the result.
5489 Module *Result = ParserResult;
5495 void llvm::GenerateError(const std::string &message, int LineNo) {
5496 if (LineNo == -1) LineNo = LLLgetLineNo();
5497 // TODO: column number in exception
5499 TheParseError->setError(LLLgetFilename(), message, LineNo);
5503 int yyerror(const char *ErrorMsg) {
5504 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
5505 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5506 if (yychar != YYEMPTY && yychar != 0) {
5507 errMsg += " while reading token: '";
5508 errMsg += std::string(LLLgetTokenStart(),
5509 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
5511 GenerateError(errMsg);