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, 150,
1163 151, 154, 2, 153, 2, 2, 2, 2, 2, 2,
1164 2, 2, 2, 2, 2, 2, 2, 2, 2, 159,
1165 152, 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, 132, 133, 136, 137, 139,
1211 141, 143, 144, 147, 149, 151, 153, 155, 157, 159,
1212 161, 163, 164, 166, 168, 170, 171, 173, 175, 176,
1213 178, 180, 182, 184, 185, 187, 189, 190, 192, 194,
1214 196, 198, 200, 203, 205, 207, 209, 211, 213, 215,
1215 217, 219, 221, 222, 225, 227, 229, 231, 233, 235,
1216 237, 238, 241, 242, 245, 246, 249, 250, 254, 257,
1217 258, 260, 261, 265, 267, 270, 272, 274, 276, 278,
1218 280, 282, 284, 286, 288, 292, 294, 297, 303, 309,
1219 315, 321, 325, 328, 334, 339, 342, 344, 346, 348,
1220 352, 354, 358, 360, 361, 363, 367, 372, 376, 380,
1221 385, 390, 394, 401, 407, 410, 413, 416, 419, 422,
1222 425, 428, 431, 434, 437, 440, 443, 450, 456, 465,
1223 472, 479, 487, 495, 502, 511, 520, 524, 526, 528,
1224 530, 532, 533, 536, 543, 545, 546, 548, 551, 552,
1225 556, 557, 561, 565, 569, 573, 574, 583, 584, 594,
1226 595, 605, 611, 614, 618, 620, 624, 628, 632, 636,
1227 638, 639, 645, 649, 651, 655, 657, 658, 669, 671,
1228 673, 678, 680, 682, 685, 689, 690, 692, 694, 696,
1229 698, 700, 702, 704, 706, 708, 712, 714, 720, 722,
1230 724, 726, 728, 730, 732, 735, 738, 741, 745, 748,
1231 749, 751, 754, 757, 761, 771, 781, 790, 805, 807,
1232 809, 816, 822, 825, 832, 840, 845, 850, 857, 864,
1233 865, 866, 870, 873, 875, 881, 887, 894, 901, 906,
1234 913, 918, 923, 930, 937, 940, 949, 951, 953, 954,
1235 958, 965, 969, 976, 979, 985, 993
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, 54, 150, 4, 151,
1252 0, 0, 171, 152, 0, 0, 20, 0, 23, 0,
1253 177, 0, 0, 175, 152, 0, 42, 0, 44, 0,
1254 43, 0, 45, 0, 47, 0, 46, 0, 48, 0,
1255 50, 0, 0, 147, 0, 148, 0, 149, 0, 0,
1256 46, 0, 48, 0, 0, 42, 0, 43, 0, 44,
1257 0, 47, 0, 0, 44, 0, 42, 0, 0, 62,
1258 0, 63, 0, 64, 0, 65, 0, 66, 0, 61,
1259 4, 0, 136, 0, 118, 0, 135, 0, 119, 0,
1260 138, 0, 139, 0, 141, 0, 142, 0, 143, 0,
1261 0, 186, 185, 0, 137, 0, 140, 0, 136, 0,
1262 135, 0, 144, 0, 145, 0, 0, 188, 187, 0,
1263 0, 146, 22, 0, 0, 53, 4, 0, 0, 153,
1264 53, 4, 0, 34, 22, 0, 0, 192, 0, 0,
1265 153, 195, 194, 0, 192, 0, 53, 4, 0, 11,
1266 0, 12, 0, 13, 0, 16, 0, 15, 0, 14,
1267 0, 17, 0, 49, 0, 196, 0, 197, 173, 154,
1268 0, 231, 0, 155, 4, 0, 197, 150, 201, 151,
1269 188, 0, 10, 150, 201, 151, 188, 0, 156, 4,
1270 157, 197, 158, 0, 159, 4, 157, 197, 160, 0,
1271 161, 202, 162, 0, 161, 162, 0, 159, 161, 202,
1272 162, 160, 0, 159, 161, 162, 160, 0, 197, 186,
1273 0, 197, 0, 10, 0, 198, 0, 200, 153, 198,
1274 0, 200, 0, 200, 153, 39, 0, 39, 0, 0,
1275 197, 0, 202, 153, 197, 0, 197, 156, 205, 158,
1276 0, 197, 156, 158, 0, 197, 163, 22, 0, 197,
1277 159, 205, 160, 0, 197, 161, 205, 162, 0, 197,
1278 161, 162, 0, 197, 159, 161, 205, 162, 160, 0,
1279 197, 159, 161, 162, 160, 0, 197, 40, 0, 197,
1280 41, 0, 197, 231, 0, 197, 204, 0, 197, 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, 150, 203, 38, 197, 151, 0, 116,
1284 150, 203, 242, 151, 0, 130, 150, 203, 153, 203,
1285 153, 203, 151, 0, 164, 150, 203, 153, 203, 151,
1286 0, 165, 150, 203, 153, 203, 151, 0, 89, 167,
1287 150, 203, 153, 203, 151, 0, 90, 168, 150, 203,
1288 153, 203, 151, 0, 132, 150, 203, 153, 203, 151,
1289 0, 133, 150, 203, 153, 203, 153, 203, 151, 0,
1290 134, 150, 203, 153, 203, 153, 203, 151, 0, 205,
1291 153, 203, 0, 203, 0, 32, 0, 33, 0, 37,
1292 0, 0, 199, 231, 0, 122, 150, 208, 38, 197,
1293 151, 0, 210, 0, 0, 211, 0, 210, 211, 0,
1294 0, 31, 212, 227, 0, 0, 30, 213, 228, 0,
1295 59, 58, 217, 0, 174, 18, 197, 0, 174, 18,
1296 10, 0, 0, 176, 180, 207, 206, 203, 173, 214,
1297 194, 0, 0, 176, 178, 180, 207, 206, 203, 173,
1298 215, 194, 0, 0, 176, 179, 180, 207, 206, 197,
1299 173, 216, 194, 0, 176, 180, 35, 183, 208, 0,
1300 51, 218, 0, 55, 152, 219, 0, 22, 0, 52,
1301 152, 22, 0, 67, 152, 22, 0, 156, 220, 158,
1302 0, 220, 153, 22, 0, 22, 0, 0, 221, 153,
1303 197, 186, 172, 0, 197, 186, 172, 0, 221, 0,
1304 221, 153, 39, 0, 39, 0, 0, 184, 199, 175,
1305 150, 222, 151, 188, 193, 190, 189, 0, 28, 0,
1306 161, 0, 182, 180, 223, 224, 0, 29, 0, 162,
1307 0, 234, 226, 0, 181, 180, 223, 0, 0, 60,
1308 0, 3, 0, 4, 0, 9, 0, 26, 0, 27,
1309 0, 40, 0, 41, 0, 25, 0, 159, 205, 160,
1310 0, 204, 0, 58, 229, 22, 153, 22, 0, 7,
1311 0, 8, 0, 171, 0, 175, 0, 231, 0, 230,
1312 0, 197, 232, 0, 234, 235, 0, 225, 235, 0,
1313 236, 174, 237, 0, 236, 239, 0, 0, 21, 0,
1314 68, 233, 0, 68, 10, 0, 69, 17, 232, 0,
1315 69, 11, 232, 153, 17, 232, 153, 17, 232, 0,
1316 70, 169, 232, 153, 17, 232, 156, 238, 158, 0,
1317 70, 169, 232, 153, 17, 232, 156, 158, 0, 71,
1318 184, 199, 232, 150, 241, 151, 188, 38, 17, 232,
1319 72, 17, 232, 0, 72, 0, 73, 0, 238, 169,
1320 230, 153, 17, 232, 0, 169, 230, 153, 17, 232,
1321 0, 174, 244, 0, 197, 156, 232, 153, 232, 158,
1322 0, 240, 153, 156, 232, 153, 232, 158, 0, 197,
1323 186, 232, 186, 0, 17, 186, 232, 186, 0, 241,
1324 153, 197, 186, 232, 186, 0, 241, 153, 17, 186,
1325 232, 186, 0, 0, 0, 242, 153, 233, 0, 57,
1326 56, 0, 56, 0, 164, 197, 232, 153, 232, 0,
1327 165, 197, 232, 153, 232, 0, 89, 167, 197, 232,
1328 153, 232, 0, 90, 168, 197, 232, 153, 232, 0,
1329 166, 233, 38, 197, 0, 130, 233, 153, 233, 153,
1330 233, 0, 131, 233, 153, 197, 0, 132, 233, 153,
1331 233, 0, 133, 233, 153, 233, 153, 233, 0, 134,
1332 233, 153, 233, 153, 233, 0, 129, 240, 0, 243,
1333 184, 199, 232, 150, 241, 151, 188, 0, 246, 0,
1334 36, 0, 0, 111, 197, 191, 0, 111, 197, 153,
1335 11, 232, 191, 0, 112, 197, 191, 0, 112, 197,
1336 153, 11, 232, 191, 0, 113, 233, 0, 245, 114,
1337 197, 232, 191, 0, 245, 115, 233, 153, 197, 232,
1338 191, 0, 116, 197, 232, 242, 0
1344 static const short yyrline[] = { 0,
1345 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1108,
1346 1108, 1108, 1108, 1108, 1108, 1109, 1109, 1109, 1109, 1109,
1347 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1113, 1113, 1114,
1348 1114, 1115, 1115, 1116, 1116, 1117, 1117, 1121, 1121, 1122,
1349 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1127,
1350 1127, 1128, 1129, 1134, 1135, 1135, 1135, 1135, 1135, 1137,
1351 1137, 1137, 1138, 1138, 1140, 1141, 1145, 1149, 1154, 1154,
1352 1156, 1157, 1162, 1168, 1169, 1170, 1171, 1172, 1176, 1177,
1353 1178, 1182, 1183, 1184, 1185, 1189, 1190, 1191, 1195, 1196,
1354 1197, 1198, 1199, 1203, 1204, 1205, 1208, 1208, 1209, 1210,
1355 1211, 1212, 1213, 1221, 1222, 1223, 1224, 1225, 1226, 1227,
1356 1228, 1229, 1232, 1233, 1238, 1239, 1240, 1241, 1242, 1243,
1357 1246, 1247, 1252, 1253, 1260, 1260, 1267, 1267, 1277, 1285,
1358 1285, 1291, 1291, 1293, 1298, 1311, 1311, 1311, 1311, 1311,
1359 1311, 1311, 1314, 1318, 1322, 1329, 1334, 1342, 1372, 1397,
1360 1402, 1412, 1422, 1426, 1436, 1443, 1452, 1459, 1464, 1469,
1361 1476, 1477, 1484, 1491, 1499, 1505, 1517, 1545, 1561, 1588,
1362 1616, 1642, 1662, 1688, 1708, 1720, 1727, 1793, 1803, 1813,
1363 1819, 1829, 1835, 1845, 1850, 1855, 1868, 1880, 1902, 1910,
1364 1916, 1927, 1932, 1937, 1943, 1949, 1958, 1962, 1970, 1970,
1365 1973, 1973, 1976, 1988, 2009, 2014, 2022, 2023, 2027, 2027,
1366 2031, 2031, 2034, 2037, 2061, 2072, 2080, 2083, 2089, 2092,
1367 2099, 2103, 2143, 2146, 2152, 2162, 2166, 2171, 2173, 2178,
1368 2183, 2192, 2202, 2213, 2217, 2226, 2235, 2240, 2374, 2374,
1369 2376, 2385, 2385, 2387, 2392, 2404, 2408, 2413, 2417, 2421,
1370 2425, 2429, 2433, 2437, 2441, 2445, 2470, 2474, 2484, 2488,
1371 2492, 2497, 2504, 2504, 2510, 2519, 2523, 2532, 2541, 2550,
1372 2554, 2561, 2565, 2569, 2574, 2584, 2603, 2612, 2696, 2700,
1373 2707, 2718, 2731, 2741, 2752, 2762, 2773, 2781, 2791, 2798,
1374 2801, 2802, 2809, 2813, 2818, 2834, 2851, 2865, 2879, 2891,
1375 2899, 2906, 2912, 2918, 2924, 2939, 3030, 3035, 3039, 3046,
1376 3053, 3061, 3068, 3076, 3084, 3098, 3115
1381 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1383 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1384 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1385 "VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1386 "LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1387 "ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1388 "GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1389 "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1390 "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","ADDRSPACE","DEPLIBS",
1391 "CALL","TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK",
1392 "COLDCC_TOK","X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR",
1393 "SWITCH","INVOKE","UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV",
1394 "UREM","SREM","FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ",
1395 "NE","SLT","SGT","SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT",
1396 "OLE","OGE","ORD","UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE",
1397 "GETELEMENTPTR","TRUNC","ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP",
1398 "FPTOUI","FPTOSI","INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT",
1399 "INSERTELEMENT","SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET",
1400 "NOUNWIND","NOALIAS","BYVAL","NEST","READNONE","READONLY","GC","DEFAULT","HIDDEN",
1401 "PROTECTED","'('","')'","'='","','","'*'","'\\\\'","'['","'x'","']'","'<'","'>'",
1402 "'{'","'}'","'c'","ArithmeticOps","LogicalOps","CastOps","IPredicates","FPredicates",
1403 "IntType","FPType","LocalName","OptLocalName","OptAddrSpace","OptLocalAssign",
1404 "GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage","GVExternalLinkage",
1405 "GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage","AliasLinkage",
1406 "OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs","OptGC",
1407 "OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1408 "PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1409 "ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1410 "Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1411 "LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1412 "FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1413 "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1414 "BBTerminatorInst","JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall",
1415 "InstVal","OptVolatile","MemoryInst", NULL
1419 static const short yyr1[] = { 0,
1420 164, 164, 164, 164, 164, 164, 164, 164, 164, 165,
1421 165, 165, 165, 165, 165, 166, 166, 166, 166, 166,
1422 166, 166, 166, 166, 166, 166, 166, 167, 167, 167,
1423 167, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1424 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1425 168, 168, 168, 169, 170, 170, 170, 170, 170, 171,
1426 171, 171, 172, 172, 173, 173, 174, 174, 175, 175,
1427 176, 176, 177, 178, 178, 178, 178, 178, 179, 179,
1428 179, 180, 180, 180, 180, 181, 181, 181, 182, 182,
1429 182, 182, 182, 183, 183, 183, 184, 184, 184, 184,
1430 184, 184, 184, 185, 185, 185, 185, 185, 185, 185,
1431 185, 185, 186, 186, 187, 187, 187, 187, 187, 187,
1432 188, 188, 189, 189, 190, 190, 191, 191, 192, 193,
1433 193, 194, 194, 195, 195, 196, 196, 196, 196, 196,
1434 196, 196, 197, 197, 197, 197, 197, 197, 197, 197,
1435 197, 197, 197, 197, 197, 198, 199, 199, 200, 200,
1436 201, 201, 201, 201, 202, 202, 203, 203, 203, 203,
1437 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
1438 203, 203, 203, 203, 203, 203, 204, 204, 204, 204,
1439 204, 204, 204, 204, 204, 204, 205, 205, 206, 206,
1440 207, 207, 208, 208, 209, 209, 210, 210, 212, 211,
1441 213, 211, 211, 211, 211, 214, 211, 215, 211, 216,
1442 211, 211, 211, 211, 217, 218, 218, 219, 220, 220,
1443 220, 221, 221, 222, 222, 222, 222, 223, 224, 224,
1444 225, 226, 226, 227, 228, 229, 229, 230, 230, 230,
1445 230, 230, 230, 230, 230, 230, 230, 230, 231, 231,
1446 231, 231, 232, 232, 233, 234, 234, 235, 236, 236,
1447 236, 237, 237, 237, 237, 237, 237, 237, 237, 237,
1448 238, 238, 239, 240, 240, 241, 241, 241, 241, 241,
1449 242, 242, 243, 243, 244, 244, 244, 244, 244, 244,
1450 244, 244, 244, 244, 244, 244, 244, 245, 245, 246,
1451 246, 246, 246, 246, 246, 246, 246
1454 static const short yyr2[] = { 0,
1455 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
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, 0, 4, 0, 2, 0, 1, 1,
1462 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1463 1, 0, 1, 1, 1, 0, 1, 1, 0, 1,
1464 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1465 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1466 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
1467 0, 2, 0, 2, 0, 2, 0, 3, 2, 0,
1468 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1469 1, 1, 1, 1, 3, 1, 2, 5, 5, 5,
1470 5, 3, 2, 5, 4, 2, 1, 1, 1, 3,
1471 1, 3, 1, 0, 1, 3, 4, 3, 3, 4,
1472 4, 3, 6, 5, 2, 2, 2, 2, 2, 2,
1473 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1474 6, 7, 7, 6, 8, 8, 3, 1, 1, 1,
1475 1, 0, 2, 6, 1, 0, 1, 2, 0, 3,
1476 0, 3, 3, 3, 3, 0, 8, 0, 9, 0,
1477 9, 5, 2, 3, 1, 3, 3, 3, 3, 1,
1478 0, 5, 3, 1, 3, 1, 0, 10, 1, 1,
1479 4, 1, 1, 2, 3, 0, 1, 1, 1, 1,
1480 1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1481 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1482 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1483 6, 5, 2, 6, 7, 4, 4, 6, 6, 0,
1484 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1485 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1489 static const short yydefact[] = { 72,
1490 60, 69, 61, 70, 62, 211, 209, 0, 0, 0,
1491 0, 0, 0, 82, 71, 72, 207, 86, 89, 0,
1492 0, 223, 0, 0, 67, 0, 73, 74, 76, 75,
1493 77, 79, 78, 80, 81, 83, 84, 85, 82, 82,
1494 202, 208, 87, 88, 82, 212, 90, 91, 92, 93,
1495 82, 270, 210, 270, 0, 0, 231, 224, 225, 213,
1496 259, 260, 215, 136, 137, 138, 141, 140, 139, 142,
1497 143, 0, 0, 0, 0, 261, 262, 144, 214, 146,
1498 202, 202, 94, 201, 0, 97, 97, 271, 267, 68,
1499 242, 243, 244, 266, 226, 227, 230, 0, 164, 147,
1500 0, 0, 0, 0, 153, 165, 0, 0, 164, 0,
1501 0, 0, 96, 95, 0, 199, 200, 0, 0, 98,
1502 99, 100, 101, 102, 0, 245, 0, 309, 269, 0,
1503 228, 163, 113, 159, 161, 0, 0, 0, 0, 0,
1504 0, 152, 0, 0, 145, 0, 0, 158, 0, 157,
1505 0, 222, 136, 137, 138, 141, 140, 139, 0, 0,
1506 66, 66, 103, 0, 239, 240, 241, 308, 294, 0,
1507 0, 0, 0, 97, 279, 280, 1, 2, 3, 4,
1508 5, 6, 7, 8, 9, 13, 14, 15, 10, 11,
1509 12, 0, 0, 0, 0, 0, 0, 16, 17, 18,
1510 19, 20, 21, 22, 23, 24, 25, 26, 27, 0,
1511 0, 0, 0, 0, 0, 0, 0, 0, 268, 97,
1512 283, 0, 307, 229, 156, 0, 121, 66, 66, 155,
1513 0, 166, 0, 121, 66, 66, 0, 203, 184, 185,
1514 180, 182, 181, 183, 186, 179, 175, 176, 0, 0,
1515 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1516 0, 0, 178, 177, 216, 0, 293, 273, 66, 272,
1517 0, 0, 54, 0, 0, 28, 29, 30, 31, 32,
1518 33, 34, 35, 36, 37, 0, 52, 53, 48, 49,
1519 50, 51, 38, 39, 40, 41, 42, 43, 44, 45,
1520 46, 47, 0, 127, 127, 314, 66, 66, 305, 0,
1521 0, 0, 0, 0, 66, 66, 0, 0, 0, 0,
1522 105, 107, 106, 104, 108, 109, 110, 111, 112, 114,
1523 162, 160, 149, 150, 151, 154, 65, 148, 218, 220,
1524 0, 0, 0, 0, 0, 0, 0, 0, 168, 198,
1525 0, 0, 0, 172, 0, 169, 0, 0, 0, 132,
1526 237, 248, 249, 250, 255, 251, 252, 253, 254, 246,
1527 0, 257, 264, 263, 265, 0, 274, 0, 0, 66,
1528 66, 0, 310, 0, 312, 291, 0, 0, 0, 0,
1529 0, 0, 0, 0, 0, 0, 0, 66, 0, 118,
1530 117, 115, 116, 119, 120, 122, 132, 132, 0, 0,
1531 0, 291, 0, 0, 0, 0, 0, 167, 153, 165,
1532 0, 170, 171, 0, 0, 0, 0, 217, 236, 113,
1533 234, 0, 247, 0, 0, 0, 0, 0, 0, 0,
1534 0, 0, 0, 317, 0, 0, 0, 301, 302, 0,
1535 0, 0, 0, 299, 0, 127, 0, 219, 221, 66,
1536 0, 0, 0, 0, 0, 0, 0, 197, 174, 0,
1537 0, 0, 0, 0, 0, 134, 132, 64, 0, 121,
1538 0, 256, 0, 0, 290, 0, 0, 127, 128, 127,
1539 0, 0, 0, 0, 0, 0, 295, 296, 290, 0,
1540 315, 66, 204, 0, 0, 188, 0, 0, 0, 0,
1541 173, 0, 0, 66, 129, 135, 133, 63, 233, 235,
1542 113, 130, 0, 0, 0, 113, 113, 0, 297, 298,
1543 311, 313, 292, 0, 0, 300, 303, 304, 0, 127,
1544 0, 0, 0, 194, 0, 0, 190, 191, 187, 64,
1545 131, 125, 258, 0, 0, 0, 0, 121, 0, 284,
1546 0, 121, 316, 192, 193, 0, 0, 0, 232, 0,
1547 123, 0, 277, 0, 0, 105, 107, 113, 113, 0,
1548 113, 113, 285, 306, 189, 195, 196, 126, 0, 238,
1549 275, 0, 276, 0, 287, 286, 0, 0, 0, 124,
1550 0, 0, 0, 113, 113, 0, 0, 0, 289, 288,
1551 282, 0, 0, 281, 0, 278, 0, 0, 0
1554 static const short yydefgoto[] = { 260,
1555 261, 262, 286, 303, 159, 160, 76, 519, 110, 12,
1556 77, 14, 15, 39, 40, 41, 45, 51, 115, 125,
1557 330, 225, 406, 333, 590, 571, 383, 476, 552, 428,
1558 477, 78, 161, 134, 151, 135, 136, 107, 350, 372,
1559 351, 118, 85, 152, 617, 16, 17, 19, 18, 360,
1560 407, 408, 60, 22, 58, 98, 431, 432, 126, 167,
1561 52, 93, 53, 46, 434, 373, 80, 375, 270, 54,
1562 89, 90, 219, 575, 129, 309, 528, 444, 220, 221,
1566 static const short yypact[] = { 253,
1567 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -4, -114, -16,
1568 -103, 46, -78, 12,-32768, 392,-32768, 149, 177, -44,
1569 -31,-32768, -1, 154,-32768, 1529,-32768,-32768,-32768,-32768,
1570 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -37, -37,
1571 203,-32768,-32768,-32768, -37,-32768,-32768,-32768,-32768,-32768,
1572 -37, 190,-32768, 2, 195, 217, 245,-32768,-32768,-32768,
1573 -32768,-32768, 124,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1574 -32768, 274, 278, 1, 505,-32768,-32768,-32768, 62,-32768,
1575 256, 256, 200,-32768, 119, 224, 224,-32768,-32768, 100,
1576 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 57, 1052,-32768,
1577 140, 148, 604, 124,-32768, 62, -69, 157, 1052, 155,
1578 119, 119,-32768,-32768, 1295,-32768,-32768, 1569, 306,-32768,
1579 -32768,-32768,-32768,-32768, 1627,-32768, -17, 1851,-32768, 289,
1580 -32768,-32768, 62,-32768, 163, 166, 1645, 1645, 158, -58,
1581 1645,-32768, 315, 171,-32768, 1569, 1645, 124, 170, 62,
1582 58,-32768, 41, 314, 318, 320, 321, 329, 226, 330,
1583 1107, 270,-32768, 30,-32768,-32768,-32768,-32768,-32768, 288,
1584 1685, 137, 336, 224,-32768,-32768,-32768,-32768,-32768,-32768,
1585 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1586 -32768, 388, 781, 1645, 1645, 1645, 1645,-32768,-32768,-32768,
1587 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1645,
1588 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645,-32768, 224,
1589 -32768, 70,-32768,-32768, 207, 1374,-32768, -15, -14,-32768,
1590 197, 62, 208,-32768, 270, -13, 1295,-32768,-32768,-32768,
1591 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 388, 781,
1592 212, 213, 214, 220, 221, 1414, 1725, 782, 351, 228,
1593 229, 231,-32768,-32768,-32768, 232,-32768, 124, 696,-32768,
1594 834, 834,-32768, 834, 1627,-32768,-32768,-32768,-32768,-32768,
1595 -32768,-32768,-32768,-32768,-32768, 1645,-32768,-32768,-32768,-32768,
1596 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1597 -32768,-32768, 1645, 15, 29,-32768, 696, 7, 205, 223,
1598 235, 236, 237, 238, 696, 696, 346, 1627, 1645, 1645,
1599 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1600 -32768,-32768, 120,-32768,-32768,-32768,-32768, 120,-32768, 155,
1601 358, 248, 249, 1569, 1569, 1569, 1569, 1569,-32768,-32768,
1602 69, 1007, -61,-32768, -56,-32768, 1569, 1569, 1569, 251,
1603 1454,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 341,
1604 1569,-32768,-32768,-32768,-32768, 252,-32768, 255, 834, 696,
1605 696, 19,-32768, 23,-32768,-32768, 834, 246, 1645, 1645,
1606 1645, 1645, 1645, 260, 266, 1645, 834, 696, 271,-32768,
1607 -32768,-32768,-32768,-32768,-32768,-32768, 251, 251, 1645, 1569,
1608 1569,-32768, 272, 275, 276, 277, 1569,-32768, 267, 962,
1609 -55,-32768,-32768, 286, 291, 371, 18,-32768,-32768, 62,
1610 292, 280,-32768, 420, -57, 431, 433, 302, 300, 301,
1611 834, 453, 834, 305, 307, 834, 309, 62,-32768, 310,
1612 311, 834, 834, 62, 316, 312, 1645,-32768,-32768, -18,
1613 323, 324, 92, 1569, 1569, 1569, 1569,-32768,-32768, 299,
1614 1569, 1569, 1645, 446, 469,-32768, 251, 729, 1472,-32768,
1615 339,-32768, 834, 834, 1743, 834, 834, 312,-32768, 312,
1616 1645, 834, 340, 1645, 1645, 1645,-32768,-32768, 1743, 421,
1617 -32768, 696,-32768, 1569, 1569,-32768, 342, 343, 344, 345,
1618 -32768, 348, 349, 16,-32768,-32768,-32768,-32768,-32768,-32768,
1619 62, -6, 474, 350, 352, 64, 62, 101,-32768,-32768,
1620 -32768,-32768,-32768, 347, 834,-32768,-32768,-32768, 115, 312,
1621 353, 356, 1569,-32768, 1569, 1569,-32768,-32768,-32768, 729,
1622 -32768, 448,-32768, 485, -5, 555, 555,-32768, 1800,-32768,
1623 365,-32768,-32768,-32768,-32768, 363, 379, 380,-32768, 530,
1624 390, 834,-32768, 1246, -2, 359, 389,-32768,-32768, 5,
1625 64, 62,-32768, 120,-32768,-32768,-32768,-32768, 516,-32768,
1626 -32768, 391,-32768, 1246, 207, 207, 524, 555, 555,-32768,
1627 525, 394, 834,-32768,-32768, 834, 526, 473, 207, 207,
1628 -32768, 834, 531,-32768, 834,-32768, 551, 556,-32768
1631 static const short yypgoto[] = { 427,
1632 437, 439, 319, 322, -172,-32768, 0, 11, -149, 480,
1633 10,-32768,-32768,-32768,-32768, 49,-32768,-32768,-32768, -147,
1634 -32768, -401,-32768, -222,-32768,-32768, -281, 51,-32768, -375,
1635 -32768,-32768, -24, 357, -117,-32768, 462, 481, -111, -157,
1636 -243, 169, 210, 354,-32768,-32768, 560,-32768,-32768,-32768,
1637 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 498,-32768,
1638 -32768,-32768,-32768,-32768,-32768, -557, -46, -66, -193,-32768,
1639 532,-32768,-32768,-32768,-32768,-32768, 88, 176,-32768,-32768,
1647 static const short yytable[] = { 11,
1648 274, 79, 306, 263, 102, 273, 162, 164, 273, 13,
1649 165, 338, 265, 353, 355, 11, 592, 310, 311, 312,
1650 313, 314, 88, 385, 317, 13, 275, 474, 478, 441,
1651 91, 458, 459, 443, 235, 108, 602, 23, 108, 108,
1652 108, 24, 597, -54, -54, -54, -54, 20, 25, 2,
1653 106, 474, 4, 28, 29, 30, 31, 32, 33, 34,
1654 108, 35, 21, 26, 61, 62, 239, 240, 108, 108,
1655 475, 442, 318, 27, 133, 442, 1, 2, 106, 3,
1656 4, 5, 108, 141, 133, 339, 340, 81, 82, 11,
1657 150, 417, 142, 86, 141, 417, 417, 417, 422, 87,
1658 150, 517, 482, 231, 238, 423, 470, 55, 421, 36,
1659 37, 38, 228, 229, 264, 108, 232, -142, 1, 550,
1660 56, 3, 236, 5, 556, 557, 399, 435, 400, 401,
1661 402, 109, 503, 403, 109, 109, 109, 404, 405, 400,
1662 401, 402, 334, 166, 403, 335, 269, 271, 404, 405,
1663 116, 117, 573, 272, 57, 593, 109, 379, 36, 37,
1664 38, 103, 387, 92, 109, 109, 549, 382, -66, 304,
1665 305, 269, 307, 266, 501, 59, 595, 596, 109, 598,
1666 599, 384, -66, 319, 320, 308, 269, 269, 269, 269,
1667 269, 315, 316, 269, 43, 447, 44, 449, 450, 451,
1668 397, 133, 609, 610, 376, 377, 531, 378, 532, 130,
1669 88, 109, 150, -142, 131, -66, 95, -142, 47, 48,
1670 49, 417, 374, 50, 374, 374, 418, 374, 241, 242,
1671 243, 244, 412, 413, 414, 415, 416, 83, 96, 84,
1672 386, 113, 506, 114, 491, 424, 425, 426, 394, 395,
1673 150, 558, -206, 559, 400, 401, 402, 522, 563, 403,
1674 374, 380, 263, 404, 405, 562, 97, 559, 374, 374,
1675 -68, 1, 2, 99, 3, 4, 5, 100, 381, 146,
1676 147, 101, 6, 7, 119, 120, 121, 122, 123, 124,
1677 111, 112, 84, 150, 398, 269, 137, 533, 461, 462,
1678 536, 537, 538, 8, 138, 468, 143, 9, 145, 163,
1679 224, 10, 438, 439, 440, 226, 227, 230, 233, 237,
1680 445, 234, -55, 108, 321, 322, -56, 420, -59, -58,
1681 455, 456, 374, 374, 374, 580, 430, -57, 245, 584,
1682 374, 323, 324, 267, 325, 326, 273, 327, 328, 329,
1683 374, 374, 507, 508, 509, 510, 336, 388, 337, 512,
1684 513, 344, 345, 346, 269, 448, 269, 269, 269, 347,
1685 348, 454, 356, 264, 488, 389, 490, 357, 358, 493,
1686 359, 361, 574, 396, 460, 497, 498, 390, 391, 392,
1687 393, -205, 541, 542, 374, 409, 374, 410, 411, 374,
1688 433, 446, 594, 427, 436, 374, 374, 437, 473, -68,
1689 1, 2, 452, 3, 4, 5, 524, 525, 453, 529,
1690 530, 6, 7, 457, 464, 534, 469, 465, 466, 467,
1691 480, 566, 502, 567, 568, 540, 374, 374, 471, 374,
1692 374, 481, 8, 472, 479, 374, 9, 483, 514, 484,
1693 10, 485, 486, 487, 521, 374, 489, 491, 511, 492,
1694 527, 494, 495, 496, 500, 499, 269, 515, 561, 269,
1695 269, 269, 516, 442, 527, 504, 505, 518, 276, 277,
1696 278, 279, 280, 281, 282, 283, 284, 285, 374, 578,
1697 579, 523, 535, 544, 543, 553, 545, 546, 547, 548,
1698 570, 572, 554, 564, 560, 591, 565, 555, -17, 374,
1699 374, 61, 62, 585, 104, 64, 65, 66, 67, 68,
1700 69, 70, 583, 1, 2, 374, 3, 4, 5, 586,
1701 587, 604, 605, 588, 582, 589, 608, 600, -18, 611,
1702 603, 606, 612, 601, 613, 614, 607, 615, 616, 518,
1703 618, 374, 374, 71, 216, 619, 374, 362, 363, 374,
1704 569, 61, 62, 364, 217, 374, 218, 342, 374, 128,
1705 144, 343, 551, 1, 2, 42, 3, 4, 5, 365,
1706 366, 367, 332, 140, 127, 94, 539, 463, 0, 0,
1707 341, 0, 0, 0, 368, 369, 0, 0, 0, 0,
1708 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1709 61, 62, 370, 104, 64, 65, 66, 67, 68, 69,
1710 70, 0, 1, 2, 0, 3, 4, 5, 177, 178,
1711 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
1712 189, 190, 191, 249, 250, 0, 0, 0, 0, 0,
1713 0, 0, 71, 0, 0, 0, 0, 0, 0, 72,
1714 73, 0, 0, 74, 0, 75, 105, 0, 0, 0,
1715 251, 198, 576, 577, 201, 202, 203, 204, 205, 206,
1716 207, 208, 209, 0, 252, 0, 253, 254, 255, 323,
1717 324, 0, 325, 326, 0, 327, 328, 329, 362, 363,
1718 0, 0, 61, 62, 364, 0, 0, 0, 0, 0,
1719 0, 0, 0, 371, 1, 2, 0, 3, 4, 5,
1720 365, 366, 367, 0, 0, 0, 0, 0, 0, 0,
1721 0, 0, 0, 0, 0, 368, 369, 0, 0, 0,
1722 0, 0, 0, 0, 0, 0, 0, 1, 0, 108,
1723 3, 0, 5, 370, 0, 0, 0, 0, 72, 73,
1724 0, 0, 74, 0, 75, 139, 0, 0, 0, 177,
1725 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1726 188, 189, 190, 191, 249, 250, 0, 0, 61, 62,
1727 0, 104, 153, 154, 155, 156, 157, 158, 70, 0,
1728 1, 2, 0, 3, 4, 5, 287, 288, 0, 0,
1729 0, 251, 198, 199, 200, 201, 202, 203, 204, 205,
1730 206, 207, 208, 209, 0, 252, 0, 253, 254, 255,
1731 71, 0, 0, 0, 0, 0, 362, 363, 0, 0,
1732 61, 62, 364, 0, 0, 109, 321, 322, 0, 0,
1733 0, 0, 1, 2, 371, 3, 4, 5, 365, 366,
1734 367, 0, 0, 323, 324, 0, 325, 326, 0, 327,
1735 328, 329, 0, 368, 369, 0, 0, 289, 290, 291,
1736 292, 293, 294, 295, 296, 297, 298, 299, 300, 301,
1737 302, 370, 0, 0, 0, 0, 0, 0, 0, 0,
1738 0, 0, 0, 0, 0, 0, 0, 177, 178, 179,
1739 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1740 190, 191, 249, 250, 0, 0, 0, 0, 0, 0,
1741 0, 0, 0, 0, 0, 0, 72, 73, 0, 0,
1742 74, 0, 75, 354, 0, 0, 0, 0, 0, 251,
1743 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1744 208, 209, 0, 252, 0, 253, 254, 255, 61, 62,
1745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1746 1, 2, 0, 3, 4, 5, 246, 0, 0, 0,
1747 0, 0, 371, 0, 0, 0, 0, 0, 0, 0,
1748 0, 247, 248, 0, 0, 0, 0, 0, 0, 0,
1749 0, 0, 0, 61, 62, 108, 104, 153, 154, 155,
1750 156, 157, 158, 70, 0, 1, 2, 0, 3, 4,
1751 5, 0, 0, 0, 0, 177, 178, 179, 180, 181,
1752 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1753 249, 250, 0, 0, 0, 71, 0, 0, 61, 62,
1754 0, 104, 64, 65, 66, 67, 68, 69, 70, 0,
1755 1, 2, 0, 3, 4, 5, 0, 251, 198, 199,
1756 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
1757 132, 252, 0, 253, 254, 255, 0, 0, 0, 0,
1758 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1759 0, 109, 0, 61, 62, -66, 0, 256, 0, 0,
1760 257, 0, 258, 0, 259, 1, 2, 0, 3, 4,
1761 5, 246, 0, 0, 0, 0, 0, 0, 0, 0,
1762 0, 0, 0, 0, 0, 0, 247, 248, 0, 0,
1763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1764 108, 72, 73, 0, 0, 74, 0, 75, 419, 0,
1765 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1766 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1767 187, 188, 189, 190, 191, 249, 250, 0, 0, 0,
1768 0, 0, 0, 0, 0, 0, 72, 73, 0, 0,
1769 74, 0, 75, 0, 0, 0, 0, 0, 0, 0,
1770 0, 0, 251, 198, 199, 200, 201, 202, 203, 204,
1771 205, 206, 207, 208, 209, 0, 252, 0, 253, 254,
1772 255, 0, 0, 0, 0, 0, 0, 0, 362, 363,
1773 0, 0, 0, 0, 364, 0, 109, 0, 0, 0,
1774 0, 0, 256, 0, 0, 257, 0, 258, 0, 259,
1775 365, 366, 367, 0, 0, 0, 0, 0, 0, 0,
1776 0, 0, 0, 0, 0, 368, 369, 0, 0, 0,
1777 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1778 0, 61, 62, 370, 148, 64, 65, 66, 67, 68,
1779 69, 70, 0, 1, 2, 0, 3, 4, 5, 177,
1780 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1781 188, 189, 190, 191, 249, 250, 0, 0, 0, 0,
1782 0, 0, 0, 71, 0, 0, 0, 0, 0, 0,
1783 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1784 0, 251, 198, 199, 200, 201, 202, 203, 204, 205,
1785 206, 207, 208, 209, 0, 252, 0, 253, 254, 255,
1786 61, 62, 0, 104, 64, 65, 66, 67, 68, 69,
1787 70, 0, 1, 2, 0, 3, 4, 5, 0, 0,
1788 0, 0, 0, 0, 371, 0, 0, 0, 0, 0,
1789 0, 0, 331, 0, 0, 0, 149, 0, 0, 0,
1790 61, 62, 71, 104, 153, 154, 155, 156, 157, 158,
1791 70, 0, 1, 2, 0, 3, 4, 5, 0, 0,
1792 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
1793 73, 0, 0, 74, 0, 75, 0, 0, 0, 0,
1794 61, 62, 71, 104, 64, 65, 66, 67, 68, 69,
1795 70, 0, 1, 2, 0, 3, 4, 5, 61, 62,
1796 0, 104, 64, 65, 66, 67, 68, 69, 70, 0,
1797 1, 2, 429, 3, 4, 5, 0, 0, 0, 0,
1798 0, 0, 71, 0, 0, 0, 0, 0, 0, 0,
1799 520, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1800 71, 0, 0, 0, 0, 0, 0, 0, 72, 73,
1801 0, 0, 74, 0, 75, 61, 62, 0, 63, 64,
1802 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1803 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1804 0, 0, 0, 0, 0, 0, 0, 0, 72, 73,
1805 0, 349, 74, 0, 75, 61, 62, 71, 104, 153,
1806 154, 155, 156, 157, 158, 70, 0, 1, 2, 0,
1807 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1808 0, 0, 0, 0, 0, 0, 0, 0, 72, 73,
1809 0, 0, 74, 0, 75, 0, 0, 71, 0, 0,
1810 0, 0, 0, 0, 0, 0, 72, 73, 0, 0,
1811 74, 0, 75, 61, 62, 0, 148, 64, 65, 66,
1812 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1813 5, 61, 62, 0, 104, 64, 65, 66, 67, 68,
1814 69, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1815 0, 0, 0, 0, 0, 71, 0, 0, 0, 0,
1816 0, 0, 0, 72, 73, 0, 0, 74, 0, 75,
1817 0, 61, 62, 71, 268, 64, 65, 66, 67, 68,
1818 69, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1819 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1820 0, 0, 0, 72, 73, 0, 0, 74, 0, 75,
1821 0, 61, 62, 71, 104, 153, 154, 155, 156, 157,
1822 158, 70, 0, 1, 2, 0, 3, 4, 5, 61,
1823 62, 0, 104, 64, 65, 66, 67, 68, 69, 526,
1824 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
1825 0, 0, 0, 71, 0, 0, 0, 0, 0, 0,
1826 0, 72, 73, 0, 0, 74, 0, 75, 0, 0,
1827 0, 71, 0, 0, 0, 0, 0, 0, 0, 72,
1828 73, 0, 0, 74, 0, 75, 61, 62, 0, 104,
1829 64, 65, 66, 67, 68, 69, 581, 0, 1, 2,
1830 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1831 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
1832 73, 0, 0, 74, 0, 75, 0, 0, 71, 0,
1833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1834 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1835 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
1836 73, 0, 0, 74, 0, 352, 168, 0, 0, 0,
1837 0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
1838 0, 74, 0, 75, 0, 0, 169, 170, 0, 0,
1839 0, 0, 0, 0, 0, 0, 0, 0, 171, 172,
1840 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1841 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
1842 193, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1843 0, 0, 0, 0, 72, 73, 0, 0, 74, 0,
1844 75, 194, 195, 196, 0, 0, 197, 198, 199, 200,
1845 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
1846 211, 212, 213, 214, 215
1849 static const short yycheck[] = { 0,
1850 173, 26, 196, 161, 4, 11, 118, 125, 11, 0,
1851 28, 234, 162, 257, 258, 16, 574, 211, 212, 213,
1852 214, 215, 21, 305, 218, 16, 174, 34, 430, 11,
1853 29, 407, 408, 11, 146, 54, 594, 152, 54, 54,
1854 54, 58, 38, 3, 4, 5, 6, 52, 152, 20,
1855 75, 34, 23, 42, 43, 44, 45, 46, 47, 48,
1856 54, 50, 67, 18, 7, 8, 26, 27, 54, 54,
1857 53, 53, 220, 152, 99, 53, 19, 20, 103, 22,
1858 23, 24, 54, 153, 109, 235, 236, 39, 40, 90,
1859 115, 153, 162, 45, 153, 153, 153, 153, 160, 51,
1860 125, 477, 160, 162, 151, 162, 162, 152, 352, 147,
1861 148, 149, 137, 138, 161, 54, 141, 54, 19, 521,
1862 152, 22, 147, 24, 526, 527, 320, 371, 135, 136,
1863 137, 150, 151, 140, 150, 150, 150, 144, 145, 135,
1864 136, 137, 158, 161, 140, 160, 171, 11, 144, 145,
1865 32, 33, 158, 17, 156, 158, 150, 275, 147, 148,
1866 149, 161, 156, 162, 150, 150, 151, 153, 154, 194,
1867 195, 196, 197, 164, 456, 22, 578, 579, 150, 581,
1868 582, 153, 154, 114, 115, 210, 211, 212, 213, 214,
1869 215, 216, 217, 218, 46, 389, 48, 391, 392, 393,
1870 318, 226, 604, 605, 271, 272, 488, 274, 490, 153,
1871 21, 150, 237, 150, 158, 154, 22, 154, 42, 43,
1872 44, 153, 269, 47, 271, 272, 158, 274, 3, 4,
1873 5, 6, 344, 345, 346, 347, 348, 35, 22, 37,
1874 307, 42, 151, 44, 153, 357, 358, 359, 315, 316,
1875 275, 151, 0, 153, 135, 136, 137, 480, 540, 140,
1876 307, 286, 420, 144, 145, 151, 22, 153, 315, 316,
1877 18, 19, 20, 150, 22, 23, 24, 4, 303, 111,
1878 112, 4, 30, 31, 61, 62, 63, 64, 65, 66,
1879 81, 82, 37, 318, 319, 320, 157, 491, 410, 411,
1880 494, 495, 496, 51, 157, 417, 150, 55, 154, 4,
1881 22, 59, 379, 380, 381, 153, 151, 160, 4, 150,
1882 387, 151, 9, 54, 118, 119, 9, 352, 9, 9,
1883 397, 398, 379, 380, 381, 558, 361, 9, 9, 562,
1884 387, 135, 136, 56, 138, 139, 11, 141, 142, 143,
1885 397, 398, 464, 465, 466, 467, 160, 153, 151, 471,
1886 472, 150, 150, 150, 389, 390, 391, 392, 393, 150,
1887 150, 396, 22, 420, 441, 153, 443, 150, 150, 446,
1888 150, 150, 555, 38, 409, 452, 453, 153, 153, 153,
1889 153, 0, 504, 505, 441, 38, 443, 150, 150, 446,
1890 60, 156, 575, 153, 153, 452, 453, 153, 38, 18,
1891 19, 20, 153, 22, 23, 24, 483, 484, 153, 486,
1892 487, 30, 31, 153, 153, 492, 160, 153, 153, 153,
1893 151, 543, 457, 545, 546, 502, 483, 484, 153, 486,
1894 487, 22, 51, 153, 153, 492, 55, 17, 473, 17,
1895 59, 150, 153, 153, 479, 502, 4, 153, 160, 153,
1896 485, 153, 153, 153, 153, 150, 491, 22, 535, 494,
1897 495, 496, 4, 53, 499, 153, 153, 478, 91, 92,
1898 93, 94, 95, 96, 97, 98, 99, 100, 535, 556,
1899 557, 153, 153, 151, 153, 22, 153, 153, 151, 151,
1900 53, 17, 153, 151, 158, 572, 151, 156, 150, 556,
1901 557, 7, 8, 151, 10, 11, 12, 13, 14, 15,
1902 16, 17, 158, 19, 20, 572, 22, 23, 24, 151,
1903 151, 598, 599, 4, 559, 146, 603, 22, 150, 606,
1904 17, 17, 17, 153, 72, 612, 153, 17, 615, 550,
1905 0, 598, 599, 49, 128, 0, 603, 3, 4, 606,
1906 550, 7, 8, 9, 128, 612, 128, 249, 615, 90,
1907 109, 250, 522, 19, 20, 16, 22, 23, 24, 25,
1908 26, 27, 226, 103, 87, 54, 499, 412, -1, -1,
1909 237, -1, -1, -1, 40, 41, -1, -1, -1, -1,
1910 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1911 7, 8, 58, 10, 11, 12, 13, 14, 15, 16,
1912 17, -1, 19, 20, -1, 22, 23, 24, 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 -1, -1, 49, -1, -1, -1, -1, -1, -1, 155,
1916 156, -1, -1, 159, -1, 161, 162, -1, -1, -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, 19, -1, 54,
1925 22, -1, 24, 58, -1, -1, -1, -1, 155, 156,
1926 -1, -1, 159, -1, 161, 162, -1, -1, -1, 74,
1927 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1928 85, 86, 87, 88, 89, 90, -1, -1, 7, 8,
1929 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
1930 19, 20, -1, 22, 23, 24, 26, 27, -1, -1,
1931 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1932 125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
1933 49, -1, -1, -1, -1, -1, 3, 4, -1, -1,
1934 7, 8, 9, -1, -1, 150, 118, 119, -1, -1,
1935 -1, -1, 19, 20, 159, 22, 23, 24, 25, 26,
1936 27, -1, -1, 135, 136, -1, 138, 139, -1, 141,
1937 142, 143, -1, 40, 41, -1, -1, 97, 98, 99,
1938 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
1939 110, 58, -1, -1, -1, -1, -1, -1, -1, -1,
1940 -1, -1, -1, -1, -1, -1, -1, 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, 155, 156, -1, -1,
1944 159, -1, 161, 162, -1, -1, -1, -1, -1, 116,
1945 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1946 127, 128, -1, 130, -1, 132, 133, 134, 7, 8,
1947 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1948 19, 20, -1, 22, 23, 24, 25, -1, -1, -1,
1949 -1, -1, 159, -1, -1, -1, -1, -1, -1, -1,
1950 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
1951 -1, -1, -1, 7, 8, 54, 10, 11, 12, 13,
1952 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1953 24, -1, -1, -1, -1, 74, 75, 76, 77, 78,
1954 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1955 89, 90, -1, -1, -1, 49, -1, -1, 7, 8,
1956 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
1957 19, 20, -1, 22, 23, 24, -1, 116, 117, 118,
1958 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
1959 39, 130, -1, 132, 133, 134, -1, -1, -1, -1,
1960 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1961 -1, 150, -1, 7, 8, 154, -1, 156, -1, -1,
1962 159, -1, 161, -1, 163, 19, 20, -1, 22, 23,
1963 24, 25, -1, -1, -1, -1, -1, -1, -1, -1,
1964 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
1965 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1966 54, 155, 156, -1, -1, 159, -1, 161, 162, -1,
1967 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1968 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
1969 84, 85, 86, 87, 88, 89, 90, -1, -1, -1,
1970 -1, -1, -1, -1, -1, -1, 155, 156, -1, -1,
1971 159, -1, 161, -1, -1, -1, -1, -1, -1, -1,
1972 -1, -1, 116, 117, 118, 119, 120, 121, 122, 123,
1973 124, 125, 126, 127, 128, -1, 130, -1, 132, 133,
1974 134, -1, -1, -1, -1, -1, -1, -1, 3, 4,
1975 -1, -1, -1, -1, 9, -1, 150, -1, -1, -1,
1976 -1, -1, 156, -1, -1, 159, -1, 161, -1, 163,
1977 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
1978 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
1979 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1980 -1, 7, 8, 58, 10, 11, 12, 13, 14, 15,
1981 16, 17, -1, 19, 20, -1, 22, 23, 24, 74,
1982 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1983 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
1984 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
1985 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1986 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1987 125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
1988 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
1989 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
1990 -1, -1, -1, -1, 159, -1, -1, -1, -1, -1,
1991 -1, -1, 39, -1, -1, -1, 122, -1, -1, -1,
1992 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
1993 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
1994 -1, -1, -1, -1, -1, -1, -1, -1, -1, 155,
1995 156, -1, -1, 159, -1, 161, -1, -1, -1, -1,
1996 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
1997 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
1998 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
1999 19, 20, 39, 22, 23, 24, -1, -1, -1, -1,
2000 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
2001 39, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2002 49, -1, -1, -1, -1, -1, -1, -1, 155, 156,
2003 -1, -1, 159, -1, 161, 7, 8, -1, 10, 11,
2004 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2005 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2006 -1, -1, -1, -1, -1, -1, -1, -1, 155, 156,
2007 -1, 158, 159, -1, 161, 7, 8, 49, 10, 11,
2008 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2009 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2010 -1, -1, -1, -1, -1, -1, -1, -1, 155, 156,
2011 -1, -1, 159, -1, 161, -1, -1, 49, -1, -1,
2012 -1, -1, -1, -1, -1, -1, 155, 156, -1, -1,
2013 159, -1, 161, 7, 8, -1, 10, 11, 12, 13,
2014 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2015 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2016 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2017 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2018 -1, -1, -1, 155, 156, -1, -1, 159, -1, 161,
2019 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2020 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2021 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2022 -1, -1, -1, 155, 156, -1, -1, 159, -1, 161,
2023 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2024 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
2025 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2026 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2027 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
2028 -1, 155, 156, -1, -1, 159, -1, 161, -1, -1,
2029 -1, 49, -1, -1, -1, -1, -1, -1, -1, 155,
2030 156, -1, -1, 159, -1, 161, 7, 8, -1, 10,
2031 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2032 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2033 -1, -1, -1, -1, -1, -1, -1, -1, -1, 155,
2034 156, -1, -1, 159, -1, 161, -1, -1, 49, -1,
2035 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2036 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2037 -1, -1, -1, -1, -1, -1, -1, -1, -1, 155,
2038 156, -1, -1, 159, -1, 161, 36, -1, -1, -1,
2039 -1, -1, -1, -1, -1, -1, -1, 155, 156, -1,
2040 -1, 159, -1, 161, -1, -1, 56, 57, -1, -1,
2041 -1, -1, -1, -1, -1, -1, -1, -1, 68, 69,
2042 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2043 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2044 90, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2045 -1, -1, -1, -1, 155, 156, -1, -1, 159, -1,
2046 161, 111, 112, 113, -1, -1, 116, 117, 118, 119,
2047 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2048 130, 131, 132, 133, 134
2050 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2051 #line 3 "/usr/share/bison.simple"
2052 /* This file comes from bison-1.28. */
2054 /* Skeleton output parser for bison,
2055 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2057 This program is free software; you can redistribute it and/or modify
2058 it under the terms of the GNU General Public License as published by
2059 the Free Software Foundation; either version 2, or (at your option)
2062 This program is distributed in the hope that it will be useful,
2063 but WITHOUT ANY WARRANTY; without even the implied warranty of
2064 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2065 GNU General Public License for more details.
2067 You should have received a copy of the GNU General Public License
2068 along with this program; if not, write to the Free Software
2069 Foundation, Inc., 59 Temple Place - Suite 330,
2070 Boston, MA 02111-1307, USA. */
2072 /* As a special exception, when this file is copied by Bison into a
2073 Bison output file, you may use that output file without restriction.
2074 This special exception was added by the Free Software Foundation
2075 in version 1.24 of Bison. */
2077 /* This is the parser code that is written into each bison parser
2078 when the %semantic_parser declaration is not specified in the grammar.
2079 It was written by Richard Stallman by simplifying the hairy parser
2080 used when %semantic_parser is specified. */
2082 #ifndef YYSTACK_USE_ALLOCA
2084 #define YYSTACK_USE_ALLOCA
2085 #else /* alloca not defined */
2087 #define YYSTACK_USE_ALLOCA
2088 #define alloca __builtin_alloca
2089 #else /* not GNU C. */
2090 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2091 #define YYSTACK_USE_ALLOCA
2093 #else /* not sparc */
2094 /* We think this test detects Watcom and Microsoft C. */
2095 /* This used to test MSDOS, but that is a bad idea
2096 since that symbol is in the user namespace. */
2097 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2098 #if 0 /* No need for malloc.h, which pollutes the namespace;
2099 instead, just don't use alloca. */
2102 #else /* not MSDOS, or __TURBOC__ */
2104 /* I don't know what this was needed for, but it pollutes the namespace.
2105 So I turned it off. rms, 2 May 1997. */
2106 /* #include <malloc.h> */
2108 #define YYSTACK_USE_ALLOCA
2109 #else /* not MSDOS, or __TURBOC__, or _AIX */
2111 #ifdef __hpux /* <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">haible at ilog.fr</a> says this works for HPUX 9.05 and up,
2112 and on HPUX 10. Eventually we can turn this on. */
2113 #define YYSTACK_USE_ALLOCA
2114 #define alloca __builtin_alloca
2117 #endif /* not _AIX */
2118 #endif /* not MSDOS, or __TURBOC__ */
2119 #endif /* not sparc */
2120 #endif /* not GNU C */
2121 #endif /* alloca not defined */
2122 #endif /* YYSTACK_USE_ALLOCA not defined */
2124 #ifdef YYSTACK_USE_ALLOCA
2125 #define YYSTACK_ALLOC alloca
2127 #define YYSTACK_ALLOC malloc
2130 /* Note: there must be only one dollar sign in this file.
2131 It is replaced by the list of actions, each action
2132 as one case of the switch. */
2134 #define yyerrok (yyerrstatus = 0)
2135 #define yyclearin (yychar = YYEMPTY)
2138 #define YYACCEPT goto yyacceptlab
2139 #define YYABORT goto yyabortlab
2140 #define YYERROR goto yyerrlab1
2141 /* Like YYERROR except do call yyerror.
2142 This remains here temporarily to ease the
2143 transition to the new meaning of YYERROR, for GCC.
2144 Once GCC version 2 has supplanted version 1, this can go. */
2145 #define YYFAIL goto yyerrlab
2146 #define YYRECOVERING() (!!yyerrstatus)
2147 #define YYBACKUP(token, value) \
2149 if (yychar == YYEMPTY && yylen == 1) \
2150 { yychar = (token), yylval = (value); \
2151 yychar1 = YYTRANSLATE (yychar); \
2156 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2160 #define YYERRCODE 256
2163 #define YYLEX yylex()
2169 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2171 #define YYLEX yylex(&yylval, &yylloc)
2173 #else /* not YYLSP_NEEDED */
2175 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2177 #define YYLEX yylex(&yylval)
2179 #endif /* not YYLSP_NEEDED */
2182 /* If nonreentrant, generate the variables here */
2186 int yychar; /* the lookahead symbol */
2187 YYSTYPE yylval; /* the semantic value of the */
2188 /* lookahead symbol */
2191 YYLTYPE yylloc; /* location data for the lookahead */
2195 int yynerrs; /* number of parse errors so far */
2196 #endif /* not YYPURE */
2199 int yydebug; /* nonzero means print parse trace */
2200 /* Since this is uninitialized, it does not stop multiple parsers
2204 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2207 #define YYINITDEPTH 200
2210 /* YYMAXDEPTH is the maximum size the stacks can grow to
2211 (effective only if the built-in stack extension method is used). */
2218 #define YYMAXDEPTH 10000
2221 /* Define __yy_memcpy. Note that the size argument
2222 should be passed with type unsigned int, because that is what the non-GCC
2223 definitions require. With GCC, __builtin_memcpy takes an arg
2224 of type size_t, but it can handle unsigned int. */
2226 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2227 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2228 #else /* not GNU C or C++ */
2231 /* This is the most reliable way to avoid incompatibilities
2232 in available built-in functions on various systems. */
2234 __yy_memcpy (to, from, count)
2239 register char *f = from;
2240 register char *t = to;
2241 register int i = count;
2247 #else /* __cplusplus */
2249 /* This is the most reliable way to avoid incompatibilities
2250 in available built-in functions on various systems. */
2252 __yy_memcpy (char *to, char *from, unsigned int count)
2254 register char *t = to;
2255 register char *f = from;
2256 register int i = count;
2265 #line 217 "/usr/share/bison.simple"
2267 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2268 into yyparse. The argument should have type void *.
2269 It should actually point to an object.
2270 Grammar actions can access the variable by casting it
2271 to the proper pointer type. */
2273 #ifdef YYPARSE_PARAM
2275 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2276 #define YYPARSE_PARAM_DECL
2277 #else /* not __cplusplus */
2278 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2279 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2280 #endif /* not __cplusplus */
2281 #else /* not YYPARSE_PARAM */
2282 #define YYPARSE_PARAM_ARG
2283 #define YYPARSE_PARAM_DECL
2284 #endif /* not YYPARSE_PARAM */
2286 /* Prevent warning if -Wstrict-prototypes. */
2288 #ifdef YYPARSE_PARAM
2289 int yyparse (void *);
2296 yyparse(YYPARSE_PARAM_ARG)
2299 register int yystate;
2301 register short *yyssp;
2302 register YYSTYPE *yyvsp;
2303 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2304 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2306 short yyssa[YYINITDEPTH]; /* the state stack */
2307 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2309 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2310 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2313 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2314 YYLTYPE *yyls = yylsa;
2317 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2319 #define YYPOPSTACK (yyvsp--, yyssp--)
2322 int yystacksize = YYINITDEPTH;
2323 int yyfree_stacks = 0;
2334 YYSTYPE yyval; /* the variable used to return */
2335 /* semantic values from the action */
2342 fprintf(stderr, "Starting parse\n");
2348 yychar = YYEMPTY; /* Cause a token to be read. */
2350 /* Initialize stack pointers.
2351 Waste one element of value and location stack
2352 so that they stay on the same level as the state stack.
2353 The wasted elements are never initialized. */
2361 /* Push a new state, which is found in yystate . */
2362 /* In all cases, when you get here, the value and location stacks
2363 have just been pushed. so pushing a state here evens the stacks. */
2368 if (yyssp >= yyss + yystacksize - 1)
2370 /* Give user a chance to reallocate the stack */
2371 /* Use copies of these so that the &'s don't force the real ones into memory. */
2372 YYSTYPE *yyvs1 = yyvs;
2373 short *yyss1 = yyss;
2375 YYLTYPE *yyls1 = yyls;
2378 /* Get the current used size of the three stacks, in elements. */
2379 int size = yyssp - yyss + 1;
2382 /* Each stack pointer address is followed by the size of
2383 the data in use in that stack, in bytes. */
2385 /* This used to be a conditional around just the two extra args,
2386 but that might be undefined if yyoverflow is a macro. */
2387 yyoverflow("parser stack overflow",
2388 &yyss1, size * sizeof (*yyssp),
2389 &yyvs1, size * sizeof (*yyvsp),
2390 &yyls1, size * sizeof (*yylsp),
2393 yyoverflow("parser stack overflow",
2394 &yyss1, size * sizeof (*yyssp),
2395 &yyvs1, size * sizeof (*yyvsp),
2399 yyss = yyss1; yyvs = yyvs1;
2403 #else /* no yyoverflow */
2404 /* Extend the stack our own way. */
2405 if (yystacksize >= YYMAXDEPTH)
2407 yyerror("parser stack overflow");
2419 if (yystacksize > YYMAXDEPTH)
2420 yystacksize = YYMAXDEPTH;
2421 #ifndef YYSTACK_USE_ALLOCA
2424 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2425 __yy_memcpy ((char *)yyss, (char *)yyss1,
2426 size * (unsigned int) sizeof (*yyssp));
2427 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2428 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2429 size * (unsigned int) sizeof (*yyvsp));
2431 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2432 __yy_memcpy ((char *)yyls, (char *)yyls1,
2433 size * (unsigned int) sizeof (*yylsp));
2435 #endif /* no yyoverflow */
2437 yyssp = yyss + size - 1;
2438 yyvsp = yyvs + size - 1;
2440 yylsp = yyls + size - 1;
2445 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2448 if (yyssp >= yyss + yystacksize - 1)
2454 fprintf(stderr, "Entering state %d\n", yystate);
2460 /* Do appropriate processing given the current state. */
2461 /* Read a lookahead token if we need one and don't already have one. */
2464 /* First try to decide what to do without reference to lookahead token. */
2466 yyn = yypact[yystate];
2470 /* Not known => get a lookahead token if don't already have one. */
2472 /* yychar is either YYEMPTY or YYEOF
2473 or a valid token in external form. */
2475 if (yychar == YYEMPTY)
2479 fprintf(stderr, "Reading a token: ");
2484 /* Convert token to internal form (in yychar1) for indexing tables with */
2486 if (yychar <= 0) /* This means end of input. */
2489 yychar = YYEOF; /* Don't call YYLEX any more */
2493 fprintf(stderr, "Now at end of input.\n");
2498 yychar1 = YYTRANSLATE(yychar);
2503 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2504 /* Give the individual parser a way to print the precise meaning
2505 of a token, for further debugging info. */
2507 YYPRINT (stderr, yychar, yylval);
2509 fprintf (stderr, ")\n");
2515 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2520 /* yyn is what to do for this token type in this state.
2521 Negative => reduce, -yyn is rule number.
2522 Positive => shift, yyn is new state.
2523 New state is final state => don't bother to shift,
2524 just return success.
2525 0, or most negative number => error. */
2540 /* Shift the lookahead token. */
2544 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2547 /* Discard the token being shifted unless it is eof. */
2548 if (yychar != YYEOF)
2556 /* count tokens shifted since error; after three, turn off error status. */
2557 if (yyerrstatus) yyerrstatus--;
2562 /* Do the default action for the current state. */
2565 yyn = yydefact[yystate];
2569 /* Do a reduction. yyn is the number of a rule to reduce with. */
2573 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2580 fprintf (stderr, "Reducing via rule %d (line %d), ",
2583 /* Print the symbols being reduced, and their result. */
2584 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2585 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2586 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2594 #line 1113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2595 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2598 #line 1113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2599 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2602 #line 1114 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2603 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2606 #line 1114 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2607 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2610 #line 1115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2611 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2614 #line 1115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2615 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2618 #line 1116 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2619 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2622 #line 1116 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2623 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2626 #line 1117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2627 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2630 #line 1117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2631 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2634 #line 1121 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2635 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2638 #line 1121 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2639 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2642 #line 1122 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2643 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2646 #line 1122 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2647 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2650 #line 1123 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2651 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2654 #line 1123 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2655 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2658 #line 1124 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2659 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2662 #line 1124 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2663 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2666 #line 1125 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2667 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2670 #line 1125 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2671 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2674 #line 1126 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2675 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2678 #line 1126 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2679 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2682 #line 1127 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2683 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2686 #line 1127 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2687 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2690 #line 1128 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2691 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2694 #line 1129 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2695 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2698 #line 1138 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2699 { yyval.StrVal = 0; ;
2702 #line 1140 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2703 { yyval.UIntVal=yyvsp[-1].UInt64Val; ;
2706 #line 1141 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2707 { yyval.UIntVal=0; ;
2710 #line 1145 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2712 yyval.StrVal = yyvsp[-1].StrVal;
2717 #line 1149 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2724 #line 1157 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2731 #line 1162 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2733 yyval.StrVal = yyvsp[-1].StrVal;
2738 #line 1168 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2739 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2742 #line 1169 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2743 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2746 #line 1170 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2747 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2750 #line 1171 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2751 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2754 #line 1172 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2755 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2758 #line 1176 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2759 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2762 #line 1177 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2763 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2766 #line 1178 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2767 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2770 #line 1182 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2771 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2774 #line 1183 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2775 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2778 #line 1184 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2779 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2782 #line 1185 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2783 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2786 #line 1189 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2787 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2790 #line 1190 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2791 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2794 #line 1191 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2795 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2798 #line 1195 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2799 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2802 #line 1196 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2803 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2806 #line 1197 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2807 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2810 #line 1198 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2811 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2814 #line 1199 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2815 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2818 #line 1203 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2819 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2822 #line 1204 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2823 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2826 #line 1205 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2827 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2830 #line 1208 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2831 { yyval.UIntVal = CallingConv::C; ;
2834 #line 1209 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2835 { yyval.UIntVal = CallingConv::C; ;
2838 #line 1210 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2839 { yyval.UIntVal = CallingConv::Fast; ;
2842 #line 1211 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2843 { yyval.UIntVal = CallingConv::Cold; ;
2846 #line 1212 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2847 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2850 #line 1213 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2851 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2854 #line 1214 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2856 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2857 GEN_ERROR("Calling conv too large");
2858 yyval.UIntVal = yyvsp[0].UInt64Val;
2863 #line 1221 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2864 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2867 #line 1222 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2868 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2871 #line 1223 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2872 { yyval.ParamAttrs = ParamAttr::SExt; ;
2875 #line 1224 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2876 { yyval.ParamAttrs = ParamAttr::SExt; ;
2879 #line 1225 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2880 { yyval.ParamAttrs = ParamAttr::InReg; ;
2883 #line 1226 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2884 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2887 #line 1227 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2888 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2891 #line 1228 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2892 { yyval.ParamAttrs = ParamAttr::ByVal; ;
2895 #line 1229 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2896 { yyval.ParamAttrs = ParamAttr::Nest; ;
2899 #line 1232 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2900 { yyval.ParamAttrs = ParamAttr::None; ;
2903 #line 1233 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2905 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2909 #line 1238 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2910 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2913 #line 1239 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2914 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2917 #line 1240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2918 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2921 #line 1241 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2922 { yyval.ParamAttrs = ParamAttr::SExt; ;
2925 #line 1242 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2926 { yyval.ParamAttrs = ParamAttr::ReadNone; ;
2929 #line 1243 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2930 { yyval.ParamAttrs = ParamAttr::ReadOnly; ;
2933 #line 1246 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2934 { yyval.ParamAttrs = ParamAttr::None; ;
2937 #line 1247 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2939 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2943 #line 1252 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2944 { yyval.StrVal = 0; ;
2947 #line 1253 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2949 yyval.StrVal = yyvsp[0].StrVal;
2953 #line 1260 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2954 { yyval.UIntVal = 0; ;
2957 #line 1261 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2959 yyval.UIntVal = yyvsp[0].UInt64Val;
2960 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2961 GEN_ERROR("Alignment must be a power of two");
2966 #line 1267 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2967 { yyval.UIntVal = 0; ;
2970 #line 1268 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2972 yyval.UIntVal = yyvsp[0].UInt64Val;
2973 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2974 GEN_ERROR("Alignment must be a power of two");
2979 #line 1277 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2981 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2982 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2983 GEN_ERROR("Invalid character in section name");
2984 yyval.StrVal = yyvsp[0].StrVal;
2989 #line 1285 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2990 { yyval.StrVal = 0; ;
2993 #line 1286 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2994 { yyval.StrVal = yyvsp[0].StrVal; ;
2997 #line 1291 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3001 #line 1292 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3005 #line 1293 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3007 CurGV->setSection(*yyvsp[0].StrVal);
3008 delete yyvsp[0].StrVal;
3013 #line 1298 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3015 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
3016 GEN_ERROR("Alignment must be a power of two");
3017 CurGV->setAlignment(yyvsp[0].UInt64Val);
3022 #line 1314 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3024 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
3029 #line 1318 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3031 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
3036 #line 1322 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3038 if (*yyvsp[-2].TypeVal == Type::LabelTy)
3039 GEN_ERROR("Cannot form a pointer to a basic block");
3040 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-2].TypeVal, yyvsp[-1].UIntVal)));
3041 delete yyvsp[-2].TypeVal;
3046 #line 1329 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3047 { // Named types are also simple types...
3048 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
3050 yyval.TypeVal = new PATypeHolder(tmp);
3054 #line 1334 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3055 { // Type UpReference
3056 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
3057 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3058 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3059 yyval.TypeVal = new PATypeHolder(OT);
3060 UR_OUT("New Upreference!\n");
3065 #line 1342 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3067 // Allow but ignore attributes on function types; this permits auto-upgrade.
3068 // FIXME: remove in LLVM 3.0.
3069 const Type* RetTy = *yyvsp[-4].TypeVal;
3070 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
3071 isa<OpaqueType>(RetTy)))
3072 GEN_ERROR("LLVM Functions cannot return aggregates");
3074 std::vector<const Type*> Params;
3075 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3076 for (; I != E; ++I ) {
3077 const Type *Ty = I->Ty->get();
3078 Params.push_back(Ty);
3081 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3082 if (isVarArg) Params.pop_back();
3084 for (unsigned i = 0; i != Params.size(); ++i)
3085 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
3086 GEN_ERROR("Function arguments must be value types!");
3090 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
3091 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3092 delete yyvsp[-4].TypeVal; // Delete the return type handle
3093 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3098 #line 1372 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3100 // Allow but ignore attributes on function types; this permits auto-upgrade.
3101 // FIXME: remove in LLVM 3.0.
3102 std::vector<const Type*> Params;
3103 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3104 for ( ; I != E; ++I ) {
3105 const Type* Ty = I->Ty->get();
3106 Params.push_back(Ty);
3109 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3110 if (isVarArg) Params.pop_back();
3112 for (unsigned i = 0; i != Params.size(); ++i)
3113 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
3114 GEN_ERROR("Function arguments must be value types!");
3118 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg);
3119 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3120 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3125 #line 1397 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3126 { // Sized array type?
3127 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3128 delete yyvsp[-1].TypeVal;
3133 #line 1402 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3135 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3136 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3137 GEN_ERROR("Unsigned result not equal to signed result");
3138 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3139 GEN_ERROR("Element type of a VectorType must be primitive");
3140 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3141 delete yyvsp[-1].TypeVal;
3146 #line 1412 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3147 { // Structure type?
3148 std::vector<const Type*> Elements;
3149 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3150 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3151 Elements.push_back(*I);
3153 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3154 delete yyvsp[-1].TypeList;
3159 #line 1422 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3160 { // Empty structure type?
3161 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3166 #line 1426 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3168 std::vector<const Type*> Elements;
3169 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3170 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3171 Elements.push_back(*I);
3173 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3174 delete yyvsp[-2].TypeList;
3179 #line 1436 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3180 { // Empty structure type?
3181 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3186 #line 1443 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3188 // Allow but ignore attributes on function types; this permits auto-upgrade.
3189 // FIXME: remove in LLVM 3.0.
3190 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3191 yyval.TypeWithAttrs.Attrs = ParamAttr::None;
3195 #line 1452 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3197 if (!UpRefs.empty())
3198 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3199 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3200 GEN_ERROR("LLVM functions cannot return aggregate types");
3201 yyval.TypeVal = yyvsp[0].TypeVal;
3205 #line 1459 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3207 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3211 #line 1464 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3213 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3214 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3219 #line 1469 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3221 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3226 #line 1477 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3228 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3229 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3230 TWA.Ty = new PATypeHolder(Type::VoidTy);
3231 yyval.TypeWithAttrsList->push_back(TWA);
3236 #line 1484 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3238 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3239 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3240 TWA.Ty = new PATypeHolder(Type::VoidTy);
3241 yyval.TypeWithAttrsList->push_back(TWA);
3246 #line 1491 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3248 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3253 #line 1499 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3255 yyval.TypeList = new std::list<PATypeHolder>();
3256 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3257 delete yyvsp[0].TypeVal;
3262 #line 1505 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3264 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3265 delete yyvsp[0].TypeVal;
3270 #line 1517 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3271 { // Nonempty unsized arr
3272 if (!UpRefs.empty())
3273 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3274 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3276 GEN_ERROR("Cannot make array constant with type: '" +
3277 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3278 const Type *ETy = ATy->getElementType();
3279 int NumElements = ATy->getNumElements();
3281 // Verify that we have the correct size...
3282 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3283 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3284 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3285 itostr(NumElements) + "");
3287 // Verify all elements are correct type!
3288 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3289 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3290 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3291 ETy->getDescription() +"' as required!\nIt is of type '"+
3292 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3295 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3296 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3301 #line 1545 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3303 if (!UpRefs.empty())
3304 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3305 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3307 GEN_ERROR("Cannot make array constant with type: '" +
3308 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3310 int NumElements = ATy->getNumElements();
3311 if (NumElements != -1 && NumElements != 0)
3312 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3313 " arguments, but has size of " + itostr(NumElements) +"");
3314 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3315 delete yyvsp[-2].TypeVal;
3320 #line 1561 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3322 if (!UpRefs.empty())
3323 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3324 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3326 GEN_ERROR("Cannot make array constant with type: '" +
3327 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3329 int NumElements = ATy->getNumElements();
3330 const Type *ETy = ATy->getElementType();
3331 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3332 GEN_ERROR("Can't build string constant of size " +
3333 itostr((int)(yyvsp[0].StrVal->length())) +
3334 " when array has size " + itostr(NumElements) + "");
3335 std::vector<Constant*> Vals;
3336 if (ETy == Type::Int8Ty) {
3337 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3338 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3340 delete yyvsp[0].StrVal;
3341 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3343 delete yyvsp[0].StrVal;
3344 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3345 delete yyvsp[-2].TypeVal;
3350 #line 1588 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3351 { // Nonempty unsized arr
3352 if (!UpRefs.empty())
3353 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3354 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3356 GEN_ERROR("Cannot make packed constant with type: '" +
3357 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3358 const Type *ETy = PTy->getElementType();
3359 int NumElements = PTy->getNumElements();
3361 // Verify that we have the correct size...
3362 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3363 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3364 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3365 itostr(NumElements) + "");
3367 // Verify all elements are correct type!
3368 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3369 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3370 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3371 ETy->getDescription() +"' as required!\nIt is of type '"+
3372 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3375 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3376 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3381 #line 1616 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3383 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3385 GEN_ERROR("Cannot make struct constant with type: '" +
3386 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3388 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3389 GEN_ERROR("Illegal number of initializers for structure type");
3391 // Check to ensure that constants are compatible with the type initializer!
3392 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3393 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3394 GEN_ERROR("Expected type '" +
3395 STy->getElementType(i)->getDescription() +
3396 "' for element #" + utostr(i) +
3397 " of structure initializer");
3399 // Check to ensure that Type is not packed
3400 if (STy->isPacked())
3401 GEN_ERROR("Unpacked Initializer to vector type '" +
3402 STy->getDescription() + "'");
3404 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3405 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3410 #line 1642 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3412 if (!UpRefs.empty())
3413 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3414 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3416 GEN_ERROR("Cannot make struct constant with type: '" +
3417 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3419 if (STy->getNumContainedTypes() != 0)
3420 GEN_ERROR("Illegal number of initializers for structure type");
3422 // Check to ensure that Type is not packed
3423 if (STy->isPacked())
3424 GEN_ERROR("Unpacked Initializer to vector type '" +
3425 STy->getDescription() + "'");
3427 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3428 delete yyvsp[-2].TypeVal;
3433 #line 1662 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3435 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3437 GEN_ERROR("Cannot make struct constant with type: '" +
3438 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3440 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3441 GEN_ERROR("Illegal number of initializers for structure type");
3443 // Check to ensure that constants are compatible with the type initializer!
3444 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3445 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3446 GEN_ERROR("Expected type '" +
3447 STy->getElementType(i)->getDescription() +
3448 "' for element #" + utostr(i) +
3449 " of structure initializer");
3451 // Check to ensure that Type is packed
3452 if (!STy->isPacked())
3453 GEN_ERROR("Vector initializer to non-vector type '" +
3454 STy->getDescription() + "'");
3456 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3457 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3462 #line 1688 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3464 if (!UpRefs.empty())
3465 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3466 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3468 GEN_ERROR("Cannot make struct constant with type: '" +
3469 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3471 if (STy->getNumContainedTypes() != 0)
3472 GEN_ERROR("Illegal number of initializers for structure type");
3474 // Check to ensure that Type is packed
3475 if (!STy->isPacked())
3476 GEN_ERROR("Vector initializer to non-vector type '" +
3477 STy->getDescription() + "'");
3479 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3480 delete yyvsp[-4].TypeVal;
3485 #line 1708 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3487 if (!UpRefs.empty())
3488 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3489 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3491 GEN_ERROR("Cannot make null pointer constant with type: '" +
3492 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3494 yyval.ConstVal = ConstantPointerNull::get(PTy);
3495 delete yyvsp[-1].TypeVal;
3500 #line 1720 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3502 if (!UpRefs.empty())
3503 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3504 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3505 delete yyvsp[-1].TypeVal;
3510 #line 1727 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3512 if (!UpRefs.empty())
3513 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3514 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3516 GEN_ERROR("Global const reference must be a pointer type");
3518 // ConstExprs can exist in the body of a function, thus creating
3519 // GlobalValues whenever they refer to a variable. Because we are in
3520 // the context of a function, getExistingVal will search the functions
3521 // symbol table instead of the module symbol table for the global symbol,
3522 // which throws things all off. To get around this, we just tell
3523 // getExistingVal that we are at global scope here.
3525 Function *SavedCurFn = CurFun.CurrentFunction;
3526 CurFun.CurrentFunction = 0;
3528 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3531 CurFun.CurrentFunction = SavedCurFn;
3533 // If this is an initializer for a constant pointer, which is referencing a
3534 // (currently) undefined variable, create a stub now that shall be replaced
3535 // in the future with the right type of variable.
3538 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3539 const PointerType *PT = cast<PointerType>(Ty);
3541 // First check to see if the forward references value is already created!
3542 PerModuleInfo::GlobalRefsType::iterator I =
3543 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3545 if (I != CurModule.GlobalRefs.end()) {
3546 V = I->second; // Placeholder already exists, use it...
3547 yyvsp[0].ValIDVal.destroy();
3550 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3551 Name = yyvsp[0].ValIDVal.getName();
3552 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3553 GEN_ERROR("Invalid reference to global");
3555 // Create the forward referenced global.
3557 if (const FunctionType *FTy =
3558 dyn_cast<FunctionType>(PT->getElementType())) {
3559 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3560 CurModule.CurrentModule);
3562 GV = new GlobalVariable(PT->getElementType(), false,
3563 GlobalValue::ExternalWeakLinkage, 0,
3564 Name, CurModule.CurrentModule);
3567 // Keep track of the fact that we have a forward ref to recycle it
3568 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3573 yyval.ConstVal = cast<GlobalValue>(V);
3574 delete yyvsp[-1].TypeVal; // Free the type handle
3579 #line 1793 "/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 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3584 GEN_ERROR("Mismatched types for constant expression: " +
3585 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3586 yyval.ConstVal = yyvsp[0].ConstVal;
3587 delete yyvsp[-1].TypeVal;
3592 #line 1803 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3594 if (!UpRefs.empty())
3595 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3596 const Type *Ty = yyvsp[-1].TypeVal->get();
3597 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3598 GEN_ERROR("Cannot create a null initialized value of this type");
3599 yyval.ConstVal = Constant::getNullValue(Ty);
3600 delete yyvsp[-1].TypeVal;
3605 #line 1813 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3606 { // integral constants
3607 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3608 GEN_ERROR("Constant value doesn't fit in type");
3609 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3614 #line 1819 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3615 { // arbitrary precision integer constants
3616 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3617 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3618 GEN_ERROR("Constant value does not fit in type");
3620 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3621 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3622 delete yyvsp[0].APIntVal;
3627 #line 1829 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3628 { // integral constants
3629 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3630 GEN_ERROR("Constant value doesn't fit in type");
3631 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3636 #line 1835 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3637 { // arbitrary precision integer constants
3638 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3639 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3640 GEN_ERROR("Constant value does not fit in type");
3642 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3643 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3644 delete yyvsp[0].APIntVal;
3649 #line 1845 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3650 { // Boolean constants
3651 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3652 yyval.ConstVal = ConstantInt::getTrue();
3657 #line 1850 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3658 { // Boolean constants
3659 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3660 yyval.ConstVal = ConstantInt::getFalse();
3665 #line 1855 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3666 { // Floating point constants
3667 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
3668 GEN_ERROR("Floating point constant invalid for type");
3669 // Lexer has no type info, so builds all float and double FP constants
3670 // as double. Fix this here. Long double is done right.
3671 if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy)
3672 yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
3673 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
3674 delete yyvsp[0].FPVal;
3679 #line 1868 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3681 if (!UpRefs.empty())
3682 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3683 Constant *Val = yyvsp[-3].ConstVal;
3684 const Type *DestTy = yyvsp[-1].TypeVal->get();
3685 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3686 GEN_ERROR("invalid cast opcode for cast from '" +
3687 Val->getType()->getDescription() + "' to '" +
3688 DestTy->getDescription() + "'");
3689 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3690 delete yyvsp[-1].TypeVal;
3694 #line 1880 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3696 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3697 GEN_ERROR("GetElementPtr requires a pointer operand");
3700 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
3703 GEN_ERROR("Index list invalid for constant getelementptr");
3705 SmallVector<Constant*, 8> IdxVec;
3706 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3707 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3708 IdxVec.push_back(C);
3710 GEN_ERROR("Indices to constant getelementptr must be constants");
3712 delete yyvsp[-1].ValueList;
3714 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3719 #line 1902 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3721 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3722 GEN_ERROR("Select condition must be of boolean type");
3723 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3724 GEN_ERROR("Select operand types must match");
3725 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3730 #line 1910 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3732 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3733 GEN_ERROR("Binary operator types must match");
3735 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3739 #line 1916 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3741 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3742 GEN_ERROR("Logical operator types must match");
3743 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3744 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3745 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3746 GEN_ERROR("Logical operator requires integral operands");
3748 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3753 #line 1927 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3755 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3756 GEN_ERROR("icmp operand types must match");
3757 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3761 #line 1932 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3763 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3764 GEN_ERROR("fcmp operand types must match");
3765 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3769 #line 1937 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3771 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3772 GEN_ERROR("Invalid extractelement operands");
3773 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3778 #line 1943 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3780 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3781 GEN_ERROR("Invalid insertelement operands");
3782 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3787 #line 1949 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3789 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3790 GEN_ERROR("Invalid shufflevector operands");
3791 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3796 #line 1958 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3798 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3803 #line 1962 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3805 yyval.ConstVector = new std::vector<Constant*>();
3806 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3811 #line 1970 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3812 { yyval.BoolVal = false; ;
3815 #line 1970 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3816 { yyval.BoolVal = true; ;
3819 #line 1973 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3820 { yyval.BoolVal = true; ;
3823 #line 1973 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3824 { yyval.BoolVal = false; ;
3827 #line 1976 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3829 const Type* VTy = yyvsp[-1].TypeVal->get();
3830 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3832 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3834 GEN_ERROR("Aliases can be created only to global values");
3836 yyval.ConstVal = Aliasee;
3838 delete yyvsp[-1].TypeVal;
3842 #line 1988 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3844 Constant *Val = yyvsp[-3].ConstVal;
3845 const Type *DestTy = yyvsp[-1].TypeVal->get();
3846 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3847 GEN_ERROR("invalid cast opcode for cast from '" +
3848 Val->getType()->getDescription() + "' to '" +
3849 DestTy->getDescription() + "'");
3851 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3853 delete yyvsp[-1].TypeVal;
3857 #line 2009 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3859 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3860 CurModule.ModuleDone();
3865 #line 2014 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3867 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3868 CurModule.ModuleDone();
3873 #line 2027 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3874 { CurFun.isDeclare = false; ;
3877 #line 2027 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3879 CurFun.FunctionDone();
3884 #line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3885 { CurFun.isDeclare = true; ;
3888 #line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3894 #line 2034 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3900 #line 2037 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3902 if (!UpRefs.empty())
3903 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3904 // Eagerly resolve types. This is not an optimization, this is a
3905 // requirement that is due to the fact that we could have this:
3907 // %list = type { %list * }
3908 // %list = type { %list * } ; repeated type decl
3910 // If types are not resolved eagerly, then the two types will not be
3911 // determined to be the same type!
3913 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3915 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3917 // If this is a named type that is not a redefinition, add it to the slot
3919 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3922 delete yyvsp[0].TypeVal;
3927 #line 2061 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3929 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3931 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3933 // If this is a named type that is not a redefinition, add it to the slot
3935 CurModule.Types.push_back(yyvsp[0].PrimType);
3941 #line 2073 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3943 /* "Externally Visible" Linkage */
3944 if (yyvsp[-1].ConstVal == 0)
3945 GEN_ERROR("Global value initializer is not a constant");
3946 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, GlobalValue::ExternalLinkage,
3947 yyvsp[-4].Visibility, yyvsp[-2].BoolVal, yyvsp[-1].ConstVal->getType(), yyvsp[-1].ConstVal, yyvsp[-3].BoolVal, yyvsp[0].UIntVal);
3952 #line 2080 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3958 #line 2084 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3960 if (yyvsp[-1].ConstVal == 0)
3961 GEN_ERROR("Global value initializer is not a constant");
3962 CurGV = ParseGlobalVariable(yyvsp[-6].StrVal, yyvsp[-5].Linkage, yyvsp[-4].Visibility, yyvsp[-2].BoolVal, yyvsp[-1].ConstVal->getType(), yyvsp[-1].ConstVal, yyvsp[-3].BoolVal, yyvsp[0].UIntVal);
3967 #line 2089 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3973 #line 2093 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3975 if (!UpRefs.empty())
3976 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3977 CurGV = ParseGlobalVariable(yyvsp[-6].StrVal, yyvsp[-5].Linkage, yyvsp[-4].Visibility, yyvsp[-2].BoolVal, *yyvsp[-1].TypeVal, 0, yyvsp[-3].BoolVal, yyvsp[0].UIntVal);
3979 delete yyvsp[-1].TypeVal;
3983 #line 2099 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3990 #line 2103 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3993 if (yyvsp[-4].StrVal) {
3994 Name = *yyvsp[-4].StrVal;
3995 delete yyvsp[-4].StrVal;
3998 GEN_ERROR("Alias name cannot be empty");
4000 Constant* Aliasee = yyvsp[0].ConstVal;
4002 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4004 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
4005 CurModule.CurrentModule);
4006 GA->setVisibility(yyvsp[-3].Visibility);
4007 InsertValue(GA, CurModule.Values);
4010 // If there was a forward reference of this alias, resolve it now.
4014 ID = ValID::createGlobalName(Name);
4016 ID = ValID::createGlobalID(CurModule.Values.size()-1);
4018 if (GlobalValue *FWGV =
4019 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
4020 // Replace uses of the fwdref with the actual alias.
4021 FWGV->replaceAllUsesWith(GA);
4022 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
4023 GV->eraseFromParent();
4025 cast<Function>(FWGV)->eraseFromParent();
4033 #line 2143 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4039 #line 2146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4045 #line 2152 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4047 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4048 if (AsmSoFar.empty())
4049 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
4051 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
4052 delete yyvsp[0].StrVal;
4057 #line 2162 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4059 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
4060 delete yyvsp[0].StrVal;
4064 #line 2166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4066 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
4067 delete yyvsp[0].StrVal;
4071 #line 2173 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4073 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4074 delete yyvsp[0].StrVal;
4079 #line 2178 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4081 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4082 delete yyvsp[0].StrVal;
4087 #line 2183 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4093 #line 2192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4095 if (!UpRefs.empty())
4096 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4097 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4098 GEN_ERROR("void typed arguments are invalid");
4099 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4100 yyval.ArgList = yyvsp[-4].ArgList;
4101 yyvsp[-4].ArgList->push_back(E);
4106 #line 2202 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4108 if (!UpRefs.empty())
4109 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4110 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4111 GEN_ERROR("void typed arguments are invalid");
4112 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4113 yyval.ArgList = new ArgListType;
4114 yyval.ArgList->push_back(E);
4119 #line 2213 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4121 yyval.ArgList = yyvsp[0].ArgList;
4126 #line 2217 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4128 yyval.ArgList = yyvsp[-2].ArgList;
4129 struct ArgListEntry E;
4130 E.Ty = new PATypeHolder(Type::VoidTy);
4132 E.Attrs = ParamAttr::None;
4133 yyval.ArgList->push_back(E);
4138 #line 2226 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4140 yyval.ArgList = new ArgListType;
4141 struct ArgListEntry E;
4142 E.Ty = new PATypeHolder(Type::VoidTy);
4144 E.Attrs = ParamAttr::None;
4145 yyval.ArgList->push_back(E);
4150 #line 2235 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4157 #line 2241 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4159 std::string FunctionName(*yyvsp[-7].StrVal);
4160 delete yyvsp[-7].StrVal; // Free strdup'd memory!
4162 // Check the function result for abstractness if this is a define. We should
4163 // have no abstract types at this point
4164 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-8].TypeVal))
4165 GEN_ERROR("Reference to abstract result: "+ yyvsp[-8].TypeVal->get()->getDescription());
4167 std::vector<const Type*> ParamTypeList;
4168 ParamAttrsVector Attrs;
4169 if (yyvsp[-3].ParamAttrs != ParamAttr::None) {
4170 ParamAttrsWithIndex PAWI;
4172 PAWI.attrs = yyvsp[-3].ParamAttrs;
4173 Attrs.push_back(PAWI);
4175 if (yyvsp[-5].ArgList) { // If there are arguments...
4177 for (ArgListType::iterator I = yyvsp[-5].ArgList->begin(); I != yyvsp[-5].ArgList->end(); ++I, ++index) {
4178 const Type* Ty = I->Ty->get();
4179 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4180 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4181 ParamTypeList.push_back(Ty);
4182 if (Ty != Type::VoidTy)
4183 if (I->Attrs != ParamAttr::None) {
4184 ParamAttrsWithIndex PAWI;
4186 PAWI.attrs = I->Attrs;
4187 Attrs.push_back(PAWI);
4192 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4193 if (isVarArg) ParamTypeList.pop_back();
4195 const ParamAttrsList *PAL = 0;
4197 PAL = ParamAttrsList::get(Attrs);
4199 FunctionType *FT = FunctionType::get(*yyvsp[-8].TypeVal, ParamTypeList, isVarArg);
4200 const PointerType *PFT = PointerType::getUnqual(FT);
4201 delete yyvsp[-8].TypeVal;
4204 if (!FunctionName.empty()) {
4205 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4207 ID = ValID::createGlobalID(CurModule.Values.size());
4211 // See if this function was forward referenced. If so, recycle the object.
4212 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4213 // Move the function to the end of the list, from whereever it was
4214 // previously inserted.
4215 Fn = cast<Function>(FWRef);
4216 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
4217 CurModule.CurrentModule->getFunctionList().remove(Fn);
4218 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4219 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4220 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4221 if (Fn->getFunctionType() != FT ) {
4222 // The existing function doesn't have the same type. This is an overload
4224 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4225 } else if (Fn->getParamAttrs() != PAL) {
4226 // The existing function doesn't have the same parameter attributes.
4227 // This is an overload error.
4228 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4229 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4230 // Neither the existing or the current function is a declaration and they
4231 // have the same name and same type. Clearly this is a redefinition.
4232 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4233 } else if (Fn->isDeclaration()) {
4234 // Make sure to strip off any argument names so we can't get conflicts.
4235 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4239 } else { // Not already defined?
4240 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4241 CurModule.CurrentModule);
4242 InsertValue(Fn, CurModule.Values);
4245 CurFun.FunctionStart(Fn);
4247 if (CurFun.isDeclare) {
4248 // If we have declaration, always overwrite linkage. This will allow us to
4249 // correctly handle cases, when pointer to function is passed as argument to
4250 // another function.
4251 Fn->setLinkage(CurFun.Linkage);
4252 Fn->setVisibility(CurFun.Visibility);
4254 Fn->setCallingConv(yyvsp[-9].UIntVal);
4255 Fn->setParamAttrs(PAL);
4256 Fn->setAlignment(yyvsp[-1].UIntVal);
4257 if (yyvsp[-2].StrVal) {
4258 Fn->setSection(*yyvsp[-2].StrVal);
4259 delete yyvsp[-2].StrVal;
4261 if (yyvsp[0].StrVal) {
4262 Fn->setCollector(yyvsp[0].StrVal->c_str());
4263 delete yyvsp[0].StrVal;
4266 // Add all of the arguments we parsed to the function...
4267 if (yyvsp[-5].ArgList) { // Is null if empty...
4268 if (isVarArg) { // Nuke the last entry
4269 assert(yyvsp[-5].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-5].ArgList->back().Name == 0 &&
4270 "Not a varargs marker!");
4271 delete yyvsp[-5].ArgList->back().Ty;
4272 yyvsp[-5].ArgList->pop_back(); // Delete the last entry
4274 Function::arg_iterator ArgIt = Fn->arg_begin();
4275 Function::arg_iterator ArgEnd = Fn->arg_end();
4277 for (ArgListType::iterator I = yyvsp[-5].ArgList->begin();
4278 I != yyvsp[-5].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4279 delete I->Ty; // Delete the typeholder...
4280 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4286 delete yyvsp[-5].ArgList; // We're now done with the argument list
4292 #line 2376 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4294 yyval.FunctionVal = CurFun.CurrentFunction;
4296 // Make sure that we keep track of the linkage type even if there was a
4297 // previous "declare".
4298 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4299 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4303 #line 2387 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4305 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4310 #line 2392 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4312 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4313 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4314 yyval.FunctionVal = CurFun.CurrentFunction;
4315 CurFun.FunctionDone();
4320 #line 2404 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4322 yyval.BoolVal = false;
4327 #line 2408 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4329 yyval.BoolVal = true;
4334 #line 2413 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4335 { // A reference to a direct constant
4336 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4341 #line 2417 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4343 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4348 #line 2421 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4349 { // Perhaps it's an FP constant?
4350 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4355 #line 2425 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4357 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4362 #line 2429 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4364 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4369 #line 2433 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4371 yyval.ValIDVal = ValID::createNull();
4376 #line 2437 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4378 yyval.ValIDVal = ValID::createUndef();
4383 #line 2441 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4384 { // A vector zero constant.
4385 yyval.ValIDVal = ValID::createZeroInit();
4390 #line 2445 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4391 { // Nonempty unsized packed vector
4392 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4393 int NumElements = yyvsp[-1].ConstVector->size();
4395 VectorType* pt = VectorType::get(ETy, NumElements);
4396 PATypeHolder* PTy = new PATypeHolder(
4404 // Verify all elements are correct type!
4405 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4406 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4407 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4408 ETy->getDescription() +"' as required!\nIt is of type '" +
4409 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4412 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4413 delete PTy; delete yyvsp[-1].ConstVector;
4418 #line 2470 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4420 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4425 #line 2474 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4427 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4428 delete yyvsp[-2].StrVal;
4429 delete yyvsp[0].StrVal;
4434 #line 2484 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4435 { // Is it an integer reference...?
4436 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4441 #line 2488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4443 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4448 #line 2492 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4449 { // Is it a named reference...?
4450 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4451 delete yyvsp[0].StrVal;
4456 #line 2497 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4457 { // Is it a named reference...?
4458 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4459 delete yyvsp[0].StrVal;
4464 #line 2510 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4466 if (!UpRefs.empty())
4467 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4468 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4469 delete yyvsp[-1].TypeVal;
4474 #line 2519 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4476 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4481 #line 2523 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4482 { // Do not allow functions with 0 basic blocks
4483 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4488 #line 2532 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4490 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4492 InsertValue(yyvsp[0].TermInstVal);
4493 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4494 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4499 #line 2541 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4501 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4502 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4503 if (CI2->getParent() == 0)
4504 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4505 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4506 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4511 #line 2550 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4512 { // Empty space between instruction lists
4513 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4518 #line 2554 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4519 { // Labelled (named) basic block
4520 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4521 delete yyvsp[0].StrVal;
4527 #line 2561 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4528 { // Return with a result...
4529 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4534 #line 2565 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4535 { // Return with no result...
4536 yyval.TermInstVal = new ReturnInst();
4541 #line 2569 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4542 { // Unconditional Branch...
4543 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4545 yyval.TermInstVal = new BranchInst(tmpBB);
4549 #line 2574 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4551 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4552 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4554 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4556 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4558 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4562 #line 2584 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4564 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4566 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4568 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4569 yyval.TermInstVal = S;
4571 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4572 E = yyvsp[-1].JumpTable->end();
4573 for (; I != E; ++I) {
4574 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4575 S->addCase(CI, I->second);
4577 GEN_ERROR("Switch case is constant, but not a simple integer");
4579 delete yyvsp[-1].JumpTable;
4584 #line 2603 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4586 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4588 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4590 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4591 yyval.TermInstVal = S;
4596 #line 2613 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4599 // Handle the short syntax
4600 const PointerType *PFTy = 0;
4601 const FunctionType *Ty = 0;
4602 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4603 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4604 // Pull out the types of all of the arguments...
4605 std::vector<const Type*> ParamTypes;
4606 ParamList::iterator I = yyvsp[-8].ParamList->begin(), E = yyvsp[-8].ParamList->end();
4607 for (; I != E; ++I) {
4608 const Type *Ty = I->Val->getType();
4609 if (Ty == Type::VoidTy)
4610 GEN_ERROR("Short call syntax cannot be used with varargs");
4611 ParamTypes.push_back(Ty);
4613 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false);
4614 PFTy = PointerType::getUnqual(Ty);
4617 delete yyvsp[-11].TypeVal;
4619 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4621 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4623 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4626 ParamAttrsVector Attrs;
4627 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4628 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4629 Attrs.push_back(PAWI);
4632 // Check the arguments
4634 if (yyvsp[-8].ParamList->empty()) { // Has no arguments?
4635 // Make sure no arguments is a good thing!
4636 if (Ty->getNumParams() != 0)
4637 GEN_ERROR("No arguments passed to a function that "
4638 "expects arguments");
4639 } else { // Has arguments?
4640 // Loop through FunctionType's arguments and ensure they are specified
4642 FunctionType::param_iterator I = Ty->param_begin();
4643 FunctionType::param_iterator E = Ty->param_end();
4644 ParamList::iterator ArgI = yyvsp[-8].ParamList->begin(), ArgE = yyvsp[-8].ParamList->end();
4647 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
4648 if (ArgI->Val->getType() != *I)
4649 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4650 (*I)->getDescription() + "'");
4651 Args.push_back(ArgI->Val);
4652 if (ArgI->Attrs != ParamAttr::None) {
4653 ParamAttrsWithIndex PAWI;
4655 PAWI.attrs = ArgI->Attrs;
4656 Attrs.push_back(PAWI);
4660 if (Ty->isVarArg()) {
4662 for (; ArgI != ArgE; ++ArgI)
4663 Args.push_back(ArgI->Val); // push the remaining varargs
4664 } else if (I != E || ArgI != ArgE)
4665 GEN_ERROR("Invalid number of parameters detected");
4668 const ParamAttrsList *PAL = 0;
4670 PAL = ParamAttrsList::get(Attrs);
4672 // Create the InvokeInst
4673 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
4674 II->setCallingConv(yyvsp[-12].UIntVal);
4675 II->setParamAttrs(PAL);
4676 yyval.TermInstVal = II;
4677 delete yyvsp[-8].ParamList;
4682 #line 2696 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4684 yyval.TermInstVal = new UnwindInst();
4689 #line 2700 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4691 yyval.TermInstVal = new UnreachableInst();
4696 #line 2707 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4698 yyval.JumpTable = yyvsp[-5].JumpTable;
4699 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4702 GEN_ERROR("May only switch on a constant pool value");
4704 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4706 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4710 #line 2718 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4712 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4713 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4717 GEN_ERROR("May only switch on a constant pool value");
4719 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4721 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4725 #line 2731 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4727 // Is this definition named?? if so, assign the name...
4728 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4730 InsertValue(yyvsp[0].InstVal);
4731 yyval.InstVal = yyvsp[0].InstVal;
4736 #line 2741 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4737 { // Used for PHI nodes
4738 if (!UpRefs.empty())
4739 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4740 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4741 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4743 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4745 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4746 delete yyvsp[-5].TypeVal;
4750 #line 2752 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4752 yyval.PHIList = yyvsp[-6].PHIList;
4753 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4755 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4757 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4761 #line 2762 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4763 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4764 if (!UpRefs.empty())
4765 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4766 // Used for call and invoke instructions
4767 yyval.ParamList = new ParamList();
4768 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal);
4769 yyval.ParamList->push_back(E);
4770 delete yyvsp[-3].TypeVal;
4775 #line 2773 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4777 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4778 // Labels are only valid in ASMs
4779 yyval.ParamList = new ParamList();
4780 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4781 yyval.ParamList->push_back(E);
4786 #line 2781 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4788 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4789 if (!UpRefs.empty())
4790 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4791 yyval.ParamList = yyvsp[-5].ParamList;
4792 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal);
4793 yyval.ParamList->push_back(E);
4794 delete yyvsp[-3].TypeVal;
4799 #line 2791 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4801 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
4802 yyval.ParamList = yyvsp[-5].ParamList;
4803 ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4804 yyval.ParamList->push_back(E);
4809 #line 2798 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4810 { yyval.ParamList = new ParamList(); ;
4813 #line 2801 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4814 { yyval.ValueList = new std::vector<Value*>(); ;
4817 #line 2802 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4819 yyval.ValueList = yyvsp[-2].ValueList;
4820 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4825 #line 2809 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4827 yyval.BoolVal = true;
4832 #line 2813 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4834 yyval.BoolVal = false;
4839 #line 2818 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4841 if (!UpRefs.empty())
4842 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4843 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4844 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4846 "Arithmetic operator requires integer, FP, or packed operands");
4847 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4849 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4851 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4852 if (yyval.InstVal == 0)
4853 GEN_ERROR("binary operator returned null");
4854 delete yyvsp[-3].TypeVal;
4858 #line 2834 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4860 if (!UpRefs.empty())
4861 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4862 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4863 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4864 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4865 GEN_ERROR("Logical operator requires integral operands");
4867 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4869 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4871 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4872 if (yyval.InstVal == 0)
4873 GEN_ERROR("binary operator returned null");
4874 delete yyvsp[-3].TypeVal;
4878 #line 2851 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4880 if (!UpRefs.empty())
4881 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4882 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4883 GEN_ERROR("Vector types not supported by icmp instruction");
4884 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4886 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4888 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4889 if (yyval.InstVal == 0)
4890 GEN_ERROR("icmp operator returned null");
4891 delete yyvsp[-3].TypeVal;
4895 #line 2865 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4897 if (!UpRefs.empty())
4898 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4899 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4900 GEN_ERROR("Vector types not supported by fcmp instruction");
4901 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4903 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4905 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4906 if (yyval.InstVal == 0)
4907 GEN_ERROR("fcmp operator returned null");
4908 delete yyvsp[-3].TypeVal;
4912 #line 2879 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4914 if (!UpRefs.empty())
4915 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4916 Value* Val = yyvsp[-2].ValueVal;
4917 const Type* DestTy = yyvsp[0].TypeVal->get();
4918 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4919 GEN_ERROR("invalid cast opcode for cast from '" +
4920 Val->getType()->getDescription() + "' to '" +
4921 DestTy->getDescription() + "'");
4922 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4923 delete yyvsp[0].TypeVal;
4927 #line 2891 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4929 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4930 GEN_ERROR("select condition must be boolean");
4931 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4932 GEN_ERROR("select value types should match");
4933 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4938 #line 2899 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4940 if (!UpRefs.empty())
4941 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4942 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4943 delete yyvsp[0].TypeVal;
4948 #line 2906 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4950 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4951 GEN_ERROR("Invalid extractelement operands");
4952 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4957 #line 2912 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4959 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4960 GEN_ERROR("Invalid insertelement operands");
4961 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4966 #line 2918 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4968 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4969 GEN_ERROR("Invalid shufflevector operands");
4970 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4975 #line 2924 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4977 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4978 if (!Ty->isFirstClassType())
4979 GEN_ERROR("PHI node operands must be of first class type");
4980 yyval.InstVal = new PHINode(Ty);
4981 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4982 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4983 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4984 GEN_ERROR("All elements of a PHI node must be of the same type");
4985 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4986 yyvsp[0].PHIList->pop_front();
4988 delete yyvsp[0].PHIList; // Free the list...
4993 #line 2940 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4996 // Handle the short syntax
4997 const PointerType *PFTy = 0;
4998 const FunctionType *Ty = 0;
4999 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
5000 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5001 // Pull out the types of all of the arguments...
5002 std::vector<const Type*> ParamTypes;
5003 ParamList::iterator I = yyvsp[-2].ParamList->begin(), E = yyvsp[-2].ParamList->end();
5004 for (; I != E; ++I) {
5005 const Type *Ty = I->Val->getType();
5006 if (Ty == Type::VoidTy)
5007 GEN_ERROR("Short call syntax cannot be used with varargs");
5008 ParamTypes.push_back(Ty);
5010 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false);
5011 PFTy = PointerType::getUnqual(Ty);
5014 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
5017 // Check for call to invalid intrinsic to avoid crashing later.
5018 if (Function *theF = dyn_cast<Function>(V)) {
5019 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5020 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5021 !theF->getIntrinsicID(true))
5022 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5023 theF->getName() + "'");
5026 // Set up the ParamAttrs for the function
5027 ParamAttrsVector Attrs;
5028 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
5029 ParamAttrsWithIndex PAWI;
5031 PAWI.attrs = yyvsp[0].ParamAttrs;
5032 Attrs.push_back(PAWI);
5034 // Check the arguments
5036 if (yyvsp[-2].ParamList->empty()) { // Has no arguments?
5037 // Make sure no arguments is a good thing!
5038 if (Ty->getNumParams() != 0)
5039 GEN_ERROR("No arguments passed to a function that "
5040 "expects arguments");
5041 } else { // Has arguments?
5042 // Loop through FunctionType's arguments and ensure they are specified
5043 // correctly. Also, gather any parameter attributes.
5044 FunctionType::param_iterator I = Ty->param_begin();
5045 FunctionType::param_iterator E = Ty->param_end();
5046 ParamList::iterator ArgI = yyvsp[-2].ParamList->begin(), ArgE = yyvsp[-2].ParamList->end();
5049 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5050 if (ArgI->Val->getType() != *I)
5051 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5052 (*I)->getDescription() + "'");
5053 Args.push_back(ArgI->Val);
5054 if (ArgI->Attrs != ParamAttr::None) {
5055 ParamAttrsWithIndex PAWI;
5057 PAWI.attrs = ArgI->Attrs;
5058 Attrs.push_back(PAWI);
5061 if (Ty->isVarArg()) {
5063 for (; ArgI != ArgE; ++ArgI)
5064 Args.push_back(ArgI->Val); // push the remaining varargs
5065 } else if (I != E || ArgI != ArgE)
5066 GEN_ERROR("Invalid number of parameters detected");
5069 // Finish off the ParamAttrs and check them
5070 const ParamAttrsList *PAL = 0;
5072 PAL = ParamAttrsList::get(Attrs);
5074 // Create the call node
5075 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
5076 CI->setTailCall(yyvsp[-7].BoolVal);
5077 CI->setCallingConv(yyvsp[-6].UIntVal);
5078 CI->setParamAttrs(PAL);
5080 delete yyvsp[-2].ParamList;
5081 delete yyvsp[-5].TypeVal;
5086 #line 3030 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5088 yyval.InstVal = yyvsp[0].InstVal;
5093 #line 3035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5095 yyval.BoolVal = true;
5100 #line 3039 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5102 yyval.BoolVal = false;
5107 #line 3046 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5109 if (!UpRefs.empty())
5110 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5111 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5112 delete yyvsp[-1].TypeVal;
5117 #line 3053 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5119 if (!UpRefs.empty())
5120 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5121 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5123 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5124 delete yyvsp[-4].TypeVal;
5128 #line 3061 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5130 if (!UpRefs.empty())
5131 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5132 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5133 delete yyvsp[-1].TypeVal;
5138 #line 3068 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5140 if (!UpRefs.empty())
5141 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5142 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5144 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5145 delete yyvsp[-4].TypeVal;
5149 #line 3076 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5151 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5152 GEN_ERROR("Trying to free nonpointer type " +
5153 yyvsp[0].ValueVal->getType()->getDescription() + "");
5154 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5159 #line 3084 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5161 if (!UpRefs.empty())
5162 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5163 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5164 GEN_ERROR("Can't load from nonpointer type: " +
5165 (*yyvsp[-2].TypeVal)->getDescription());
5166 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5167 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5168 (*yyvsp[-2].TypeVal)->getDescription());
5169 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5171 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5172 delete yyvsp[-2].TypeVal;
5176 #line 3098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5178 if (!UpRefs.empty())
5179 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5180 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5182 GEN_ERROR("Can't store to a nonpointer type: " +
5183 (*yyvsp[-2].TypeVal)->getDescription());
5184 const Type *ElTy = PT->getElementType();
5185 if (ElTy != yyvsp[-4].ValueVal->getType())
5186 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5187 "' into space of type '" + ElTy->getDescription() + "'");
5189 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5191 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5192 delete yyvsp[-2].TypeVal;
5196 #line 3115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5198 if (!UpRefs.empty())
5199 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5200 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5201 GEN_ERROR("getelementptr insn requires pointer operand");
5203 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
5204 GEN_ERROR("Invalid getelementptr indices for type '" +
5205 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5206 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5208 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
5209 delete yyvsp[-2].TypeVal;
5210 delete yyvsp[0].ValueList;
5214 /* the action file gets copied in in place of this dollarsign */
5215 #line 543 "/usr/share/bison.simple"
5226 short *ssp1 = yyss - 1;
5227 fprintf (stderr, "state stack now");
5228 while (ssp1 != yyssp)
5229 fprintf (stderr, " %d", *++ssp1);
5230 fprintf (stderr, "\n");
5240 yylsp->first_line = yylloc.first_line;
5241 yylsp->first_column = yylloc.first_column;
5242 yylsp->last_line = (yylsp-1)->last_line;
5243 yylsp->last_column = (yylsp-1)->last_column;
5248 yylsp->last_line = (yylsp+yylen-1)->last_line;
5249 yylsp->last_column = (yylsp+yylen-1)->last_column;
5253 /* Now "shift" the result of the reduction.
5254 Determine what state that goes to,
5255 based on the state we popped back to
5256 and the rule number reduced by. */
5260 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5261 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5262 yystate = yytable[yystate];
5264 yystate = yydefgoto[yyn - YYNTBASE];
5268 yyerrlab: /* here on detecting error */
5271 /* If not already recovering from an error, report this error. */
5275 #ifdef YYERROR_VERBOSE
5276 yyn = yypact[yystate];
5278 if (yyn > YYFLAG && yyn < YYLAST)
5285 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5286 for (x = (yyn < 0 ? -yyn : 0);
5287 x < (sizeof(yytname) / sizeof(char *)); x++)
5288 if (yycheck[x + yyn] == x)
5289 size += strlen(yytname[x]) + 15, count++;
5290 msg = (char *) malloc(size + 15);
5293 strcpy(msg, "parse error");
5298 for (x = (yyn < 0 ? -yyn : 0);
5299 x < (sizeof(yytname) / sizeof(char *)); x++)
5300 if (yycheck[x + yyn] == x)
5302 strcat(msg, count == 0 ? ", expecting `" : " or `");
5303 strcat(msg, yytname[x]);
5312 yyerror ("parse error; also virtual memory exceeded");
5315 #endif /* YYERROR_VERBOSE */
5316 yyerror("parse error");
5320 yyerrlab1: /* here on error raised explicitly by an action */
5322 if (yyerrstatus == 3)
5324 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5326 /* return failure if at end of input */
5327 if (yychar == YYEOF)
5332 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5338 /* Else will try to reuse lookahead token
5339 after shifting the error token. */
5341 yyerrstatus = 3; /* Each real token shifted decrements this */
5345 yyerrdefault: /* current state does not do anything special for the error token. */
5348 /* This is wrong; only states that explicitly want error tokens
5349 should shift them. */
5350 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5351 if (yyn) goto yydefault;
5354 yyerrpop: /* pop the current state because it cannot handle the error token */
5356 if (yyssp == yyss) YYABORT;
5366 short *ssp1 = yyss - 1;
5367 fprintf (stderr, "Error: state stack now");
5368 while (ssp1 != yyssp)
5369 fprintf (stderr, " %d", *++ssp1);
5370 fprintf (stderr, "\n");
5376 yyn = yypact[yystate];
5381 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5400 fprintf(stderr, "Shifting error token, ");
5412 /* YYACCEPT comes here. */
5424 /* YYABORT comes here. */
5435 #line 3132 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5438 // common code from the two 'RunVMAsmParser' functions
5439 static Module* RunParser(Module * M) {
5440 CurModule.CurrentModule = M;
5441 // Check to make sure the parser succeeded
5444 delete ParserResult;
5448 // Emit an error if there are any unresolved types left.
5449 if (!CurModule.LateResolveTypes.empty()) {
5450 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5451 if (DID.Type == ValID::LocalName) {
5452 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5454 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5457 delete ParserResult;
5461 // Emit an error if there are any unresolved values left.
5462 if (!CurModule.LateResolveValues.empty()) {
5463 Value *V = CurModule.LateResolveValues.back();
5464 std::map<Value*, std::pair<ValID, int> >::iterator I =
5465 CurModule.PlaceHolderInfo.find(V);
5467 if (I != CurModule.PlaceHolderInfo.end()) {
5468 ValID &DID = I->second.first;
5469 if (DID.Type == ValID::LocalName) {
5470 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5472 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5475 delete ParserResult;
5480 // Check to make sure that parsing produced a result
5484 // Reset ParserResult variable while saving its value for the result.
5485 Module *Result = ParserResult;
5491 void llvm::GenerateError(const std::string &message, int LineNo) {
5492 if (LineNo == -1) LineNo = LLLgetLineNo();
5493 // TODO: column number in exception
5495 TheParseError->setError(LLLgetFilename(), message, LineNo);
5499 int yyerror(const char *ErrorMsg) {
5500 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
5501 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5502 if (yychar != YYEMPTY && yychar != 0) {
5503 errMsg += " while reading token: '";
5504 errMsg += std::string(LLLgetTokenStart(),
5505 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
5507 GenerateError(errMsg);