2 /* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse llvmAsmparse
8 #define yylex llvmAsmlex
9 #define yyerror llvmAsmerror
10 #define yylval llvmAsmlval
11 #define yychar llvmAsmchar
12 #define yydebug llvmAsmdebug
13 #define yynerrs llvmAsmnerrs
14 #define ESINT64VAL 257
15 #define EUINT64VAL 258
16 #define ESAPINTVAL 259
17 #define EUAPINTVAL 260
18 #define LOCALVAL_ID 261
19 #define GLOBALVAL_ID 262
30 #define STRINGCONSTANT 273
31 #define ATSTRINGCONSTANT 274
32 #define PCTSTRINGCONSTANT 275
33 #define ZEROINITIALIZER 276
45 #define THREAD_LOCAL 288
56 #define EXTERN_WEAK 299
67 #define SIDEEFFECT 310
70 #define FASTCC_TOK 313
71 #define COLDCC_TOK 314
72 #define X86_STDCALLCC_TOK 315
73 #define X86_FASTCALLCC_TOK 316
74 #define DATALAYOUT 317
80 #define UNREACHABLE 323
123 #define GETELEMENTPTR 366
139 #define EXTRACTELEMENT 382
140 #define INSERTELEMENT 383
141 #define SHUFFLEVECTOR 384
149 #define PROTECTED 392
151 #line 14 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
153 #include "ParserInternals.h"
154 #include "llvm/CallingConv.h"
155 #include "llvm/InlineAsm.h"
156 #include "llvm/Instructions.h"
157 #include "llvm/Module.h"
158 #include "llvm/ValueSymbolTable.h"
159 #include "llvm/Support/GetElementPtrTypeIterator.h"
160 #include "llvm/Support/CommandLine.h"
161 #include "llvm/ADT/SmallVector.h"
162 #include "llvm/ADT/STLExtras.h"
163 #include "llvm/Support/MathExtras.h"
164 #include "llvm/Support/Streams.h"
173 // The following is a gross hack. In order to rid the libAsmParser library of
174 // exceptions, we have to have a way of getting the yyparse function to go into
175 // an error situation. So, whenever we want an error to occur, the GenerateError
176 // function (see bottom of file) sets TriggerError. Then, at the end of each
177 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
178 // (a goto) to put YACC in error state. Furthermore, several calls to
179 // GenerateError are made from inside productions and they must simulate the
180 // previous exception behavior by exiting the production immediately. We have
181 // replaced these with the GEN_ERROR macro which calls GeneratError and then
182 // immediately invokes YYERROR. This would be so much cleaner if it was a
183 // recursive descent parser.
184 static bool TriggerError = false;
185 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
186 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
188 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
189 int yylex(); // declaration" of xxx warnings.
193 std::string CurFilename;
196 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
197 cl::Hidden, cl::init(false));
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 Values.clear(); // Clear out function local definitions
277 // GetForwardRefForGlobal - Check to see if there is a forward reference
278 // for this global. If so, remove it from the GlobalRefs map and return it.
279 // If not, just return null.
280 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
281 // Check to see if there is a forward reference to this global variable...
282 // if there is, eliminate it and patch the reference to use the new def'n.
283 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
284 GlobalValue *Ret = 0;
285 if (I != GlobalRefs.end()) {
292 bool TypeIsUnresolved(PATypeHolder* PATy) {
293 // If it isn't abstract, its resolved
294 const Type* Ty = PATy->get();
295 if (!Ty->isAbstract())
297 // Traverse the type looking for abstract types. If it isn't abstract then
298 // we don't need to traverse that leg of the type.
299 std::vector<const Type*> WorkList, SeenList;
300 WorkList.push_back(Ty);
301 while (!WorkList.empty()) {
302 const Type* Ty = WorkList.back();
303 SeenList.push_back(Ty);
305 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
306 // Check to see if this is an unresolved type
307 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
308 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
309 for ( ; I != E; ++I) {
310 if (I->second.get() == OpTy)
313 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
314 const Type* TheTy = SeqTy->getElementType();
315 if (TheTy->isAbstract() && TheTy != Ty) {
316 std::vector<const Type*>::iterator I = SeenList.begin(),
322 WorkList.push_back(TheTy);
324 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
325 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
326 const Type* TheTy = StrTy->getElementType(i);
327 if (TheTy->isAbstract() && TheTy != Ty) {
328 std::vector<const Type*>::iterator I = SeenList.begin(),
334 WorkList.push_back(TheTy);
343 static struct PerFunctionInfo {
344 Function *CurrentFunction; // Pointer to current function being created
346 ValueList Values; // Keep track of #'d definitions
348 ValueList LateResolveValues;
349 bool isDeclare; // Is this function a forward declararation?
350 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
351 GlobalValue::VisibilityTypes Visibility;
353 /// BBForwardRefs - When we see forward references to basic blocks, keep
354 /// track of them here.
355 std::map<ValID, BasicBlock*> BBForwardRefs;
357 inline PerFunctionInfo() {
360 Linkage = GlobalValue::ExternalLinkage;
361 Visibility = GlobalValue::DefaultVisibility;
364 inline void FunctionStart(Function *M) {
369 void FunctionDone() {
370 // Any forward referenced blocks left?
371 if (!BBForwardRefs.empty()) {
372 GenerateError("Undefined reference to label " +
373 BBForwardRefs.begin()->second->getName());
377 // Resolve all forward references now.
378 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
380 Values.clear(); // Clear out function local definitions
381 BBForwardRefs.clear();
384 Linkage = GlobalValue::ExternalLinkage;
385 Visibility = GlobalValue::DefaultVisibility;
387 } CurFun; // Info for the current function...
389 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
392 //===----------------------------------------------------------------------===//
393 // Code to handle definitions of all the types
394 //===----------------------------------------------------------------------===//
396 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
397 // Things that have names or are void typed don't get slot numbers
398 if (V->hasName() || (V->getType() == Type::VoidTy))
401 // In the case of function values, we have to allow for the forward reference
402 // of basic blocks, which are included in the numbering. Consequently, we keep
403 // track of the next insertion location with NextValNum. When a BB gets
404 // inserted, it could change the size of the CurFun.Values vector.
405 if (&ValueTab == &CurFun.Values) {
406 if (ValueTab.size() <= CurFun.NextValNum)
407 ValueTab.resize(CurFun.NextValNum+1);
408 ValueTab[CurFun.NextValNum++] = V;
411 // For all other lists, its okay to just tack it on the back of the vector.
412 ValueTab.push_back(V);
415 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
417 case ValID::LocalID: // Is it a numbered definition?
418 // Module constants occupy the lowest numbered slots...
419 if (D.Num < CurModule.Types.size())
420 return CurModule.Types[D.Num];
422 case ValID::LocalName: // Is it a named definition?
423 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
424 D.destroy(); // Free old strdup'd memory...
429 GenerateError("Internal parser error: Invalid symbol type reference");
433 // If we reached here, we referenced either a symbol that we don't know about
434 // or an id number that hasn't been read yet. We may be referencing something
435 // forward, so just create an entry to be resolved later and get to it...
437 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
440 if (inFunctionScope()) {
441 if (D.Type == ValID::LocalName) {
442 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
445 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
450 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
451 if (I != CurModule.LateResolveTypes.end())
454 Type *Typ = OpaqueType::get();
455 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
459 // getExistingVal - Look up the value specified by the provided type and
460 // the provided ValID. If the value exists and has already been defined, return
461 // it. Otherwise return null.
463 static Value *getExistingVal(const Type *Ty, const ValID &D) {
464 if (isa<FunctionType>(Ty)) {
465 GenerateError("Functions are not values and "
466 "must be referenced as pointers");
471 case ValID::LocalID: { // Is it a numbered definition?
472 // Check that the number is within bounds.
473 if (D.Num >= CurFun.Values.size())
475 Value *Result = CurFun.Values[D.Num];
476 if (Ty != Result->getType()) {
477 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
478 Result->getType()->getDescription() + "' does not match "
479 "expected type, '" + Ty->getDescription() + "'");
484 case ValID::GlobalID: { // Is it a numbered definition?
485 if (D.Num >= CurModule.Values.size())
487 Value *Result = CurModule.Values[D.Num];
488 if (Ty != Result->getType()) {
489 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
490 Result->getType()->getDescription() + "' does not match "
491 "expected type, '" + Ty->getDescription() + "'");
497 case ValID::LocalName: { // Is it a named definition?
498 if (!inFunctionScope())
500 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
501 Value *N = SymTab.lookup(D.getName());
504 if (N->getType() != Ty)
507 D.destroy(); // Free old strdup'd memory...
510 case ValID::GlobalName: { // Is it a named definition?
511 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
512 Value *N = SymTab.lookup(D.getName());
515 if (N->getType() != Ty)
518 D.destroy(); // Free old strdup'd memory...
522 // Check to make sure that "Ty" is an integral type, and that our
523 // value will fit into the specified type...
524 case ValID::ConstSIntVal: // Is it a constant pool reference??
525 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
526 GenerateError("Signed integral constant '" +
527 itostr(D.ConstPool64) + "' is invalid for type '" +
528 Ty->getDescription() + "'");
531 return ConstantInt::get(Ty, D.ConstPool64, true);
533 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
534 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
535 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
536 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
537 "' is invalid or out of range");
539 } else { // This is really a signed reference. Transmogrify.
540 return ConstantInt::get(Ty, D.ConstPool64, true);
543 return ConstantInt::get(Ty, D.UConstPool64);
546 case ValID::ConstFPVal: // Is it a floating point const pool reference?
547 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
548 GenerateError("FP constant invalid for type");
551 return ConstantFP::get(Ty, D.ConstPoolFP);
553 case ValID::ConstNullVal: // Is it a null value?
554 if (!isa<PointerType>(Ty)) {
555 GenerateError("Cannot create a a non pointer null");
558 return ConstantPointerNull::get(cast<PointerType>(Ty));
560 case ValID::ConstUndefVal: // Is it an undef value?
561 return UndefValue::get(Ty);
563 case ValID::ConstZeroVal: // Is it a zero value?
564 return Constant::getNullValue(Ty);
566 case ValID::ConstantVal: // Fully resolved constant?
567 if (D.ConstantValue->getType() != Ty) {
568 GenerateError("Constant expression type different from required type");
571 return D.ConstantValue;
573 case ValID::InlineAsmVal: { // Inline asm expression
574 const PointerType *PTy = dyn_cast<PointerType>(Ty);
575 const FunctionType *FTy =
576 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
577 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
578 GenerateError("Invalid type for asm constraint string");
581 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
582 D.IAD->HasSideEffects);
583 D.destroy(); // Free InlineAsmDescriptor.
587 assert(0 && "Unhandled case!");
591 assert(0 && "Unhandled case!");
595 // getVal - This function is identical to getExistingVal, except that if a
596 // value is not already defined, it "improvises" by creating a placeholder var
597 // that looks and acts just like the requested variable. When the value is
598 // defined later, all uses of the placeholder variable are replaced with the
601 static Value *getVal(const Type *Ty, const ValID &ID) {
602 if (Ty == Type::LabelTy) {
603 GenerateError("Cannot use a basic block here");
607 // See if the value has already been defined.
608 Value *V = getExistingVal(Ty, ID);
610 if (TriggerError) return 0;
612 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
613 GenerateError("Invalid use of a composite type");
617 // If we reached here, we referenced either a symbol that we don't know about
618 // or an id number that hasn't been read yet. We may be referencing something
619 // forward, so just create an entry to be resolved later and get to it...
622 case ValID::GlobalName:
623 case ValID::GlobalID: {
624 const PointerType *PTy = dyn_cast<PointerType>(Ty);
626 GenerateError("Invalid type for reference to global" );
629 const Type* ElTy = PTy->getElementType();
630 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
631 V = new Function(FTy, GlobalValue::ExternalLinkage);
633 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
637 V = new Argument(Ty);
640 // Remember where this forward reference came from. FIXME, shouldn't we try
641 // to recycle these things??
642 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
645 if (inFunctionScope())
646 InsertValue(V, CurFun.LateResolveValues);
648 InsertValue(V, CurModule.LateResolveValues);
652 /// defineBBVal - This is a definition of a new basic block with the specified
653 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
654 static BasicBlock *defineBBVal(const ValID &ID) {
655 assert(inFunctionScope() && "Can't get basic block at global scope!");
659 // First, see if this was forward referenced
661 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
662 if (BBI != CurFun.BBForwardRefs.end()) {
664 // The forward declaration could have been inserted anywhere in the
665 // function: insert it into the correct place now.
666 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
667 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
669 // We're about to erase the entry, save the key so we can clean it up.
670 ValID Tmp = BBI->first;
672 // Erase the forward ref from the map as its no longer "forward"
673 CurFun.BBForwardRefs.erase(ID);
675 // The key has been removed from the map but so we don't want to leave
676 // strdup'd memory around so destroy it too.
679 // If its a numbered definition, bump the number and set the BB value.
680 if (ID.Type == ValID::LocalID) {
681 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
689 // We haven't seen this BB before and its first mention is a definition.
690 // Just create it and return it.
691 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
692 BB = new BasicBlock(Name, CurFun.CurrentFunction);
693 if (ID.Type == ValID::LocalID) {
694 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
698 ID.destroy(); // Free strdup'd memory
702 /// getBBVal - get an existing BB value or create a forward reference for it.
704 static BasicBlock *getBBVal(const ValID &ID) {
705 assert(inFunctionScope() && "Can't get basic block at global scope!");
709 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
710 if (BBI != CurFun.BBForwardRefs.end()) {
712 } if (ID.Type == ValID::LocalName) {
713 std::string Name = ID.getName();
714 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
716 if (N->getType()->getTypeID() == Type::LabelTyID)
717 BB = cast<BasicBlock>(N);
719 GenerateError("Reference to label '" + Name + "' is actually of type '"+
720 N->getType()->getDescription() + "'");
721 } else if (ID.Type == ValID::LocalID) {
722 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
723 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
724 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
726 GenerateError("Reference to label '%" + utostr(ID.Num) +
727 "' is actually of type '"+
728 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
731 GenerateError("Illegal label reference " + ID.getName());
735 // If its already been defined, return it now.
737 ID.destroy(); // Free strdup'd memory.
741 // Otherwise, this block has not been seen before, create it.
743 if (ID.Type == ValID::LocalName)
745 BB = new BasicBlock(Name, CurFun.CurrentFunction);
747 // Insert it in the forward refs map.
748 CurFun.BBForwardRefs[ID] = BB;
754 //===----------------------------------------------------------------------===//
755 // Code to handle forward references in instructions
756 //===----------------------------------------------------------------------===//
758 // This code handles the late binding needed with statements that reference
759 // values not defined yet... for example, a forward branch, or the PHI node for
762 // This keeps a table (CurFun.LateResolveValues) of all such forward references
763 // and back patchs after we are done.
766 // ResolveDefinitions - If we could not resolve some defs at parsing
767 // time (forward branches, phi functions for loops, etc...) resolve the
771 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
772 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
773 while (!LateResolvers.empty()) {
774 Value *V = LateResolvers.back();
775 LateResolvers.pop_back();
777 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
778 CurModule.PlaceHolderInfo.find(V);
779 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
781 ValID &DID = PHI->second.first;
783 Value *TheRealValue = getExistingVal(V->getType(), DID);
787 V->replaceAllUsesWith(TheRealValue);
789 CurModule.PlaceHolderInfo.erase(PHI);
790 } else if (FutureLateResolvers) {
791 // Functions have their unresolved items forwarded to the module late
793 InsertValue(V, *FutureLateResolvers);
795 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
796 GenerateError("Reference to an invalid definition: '" +DID.getName()+
797 "' of type '" + V->getType()->getDescription() + "'",
801 GenerateError("Reference to an invalid definition: #" +
802 itostr(DID.Num) + " of type '" +
803 V->getType()->getDescription() + "'",
809 LateResolvers.clear();
812 // ResolveTypeTo - A brand new type was just declared. This means that (if
813 // name is not null) things referencing Name can be resolved. Otherwise, things
814 // refering to the number can be resolved. Do this now.
816 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
819 D = ValID::createLocalName(*Name);
821 D = ValID::createLocalID(CurModule.Types.size());
823 std::map<ValID, PATypeHolder>::iterator I =
824 CurModule.LateResolveTypes.find(D);
825 if (I != CurModule.LateResolveTypes.end()) {
826 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
827 CurModule.LateResolveTypes.erase(I);
831 // setValueName - Set the specified value to the name given. The name may be
832 // null potentially, in which case this is a noop. The string passed in is
833 // assumed to be a malloc'd string buffer, and is free'd by this function.
835 static void setValueName(Value *V, std::string *NameStr) {
836 if (!NameStr) return;
837 std::string Name(*NameStr); // Copy string
838 delete NameStr; // Free old string
840 if (V->getType() == Type::VoidTy) {
841 GenerateError("Can't assign name '" + Name+"' to value with void type");
845 assert(inFunctionScope() && "Must be in function scope!");
846 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
847 if (ST.lookup(Name)) {
848 GenerateError("Redefinition of value '" + Name + "' of type '" +
849 V->getType()->getDescription() + "'");
857 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
858 /// this is a declaration, otherwise it is a definition.
859 static GlobalVariable *
860 ParseGlobalVariable(std::string *NameStr,
861 GlobalValue::LinkageTypes Linkage,
862 GlobalValue::VisibilityTypes Visibility,
863 bool isConstantGlobal, const Type *Ty,
864 Constant *Initializer, bool IsThreadLocal) {
865 if (isa<FunctionType>(Ty)) {
866 GenerateError("Cannot declare global vars of function type");
870 const PointerType *PTy = PointerType::get(Ty);
874 Name = *NameStr; // Copy string
875 delete NameStr; // Free old string
878 // See if this global value was forward referenced. If so, recycle the
882 ID = ValID::createGlobalName(Name);
884 ID = ValID::createGlobalID(CurModule.Values.size());
887 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
888 // Move the global to the end of the list, from whereever it was
889 // previously inserted.
890 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
891 CurModule.CurrentModule->getGlobalList().remove(GV);
892 CurModule.CurrentModule->getGlobalList().push_back(GV);
893 GV->setInitializer(Initializer);
894 GV->setLinkage(Linkage);
895 GV->setVisibility(Visibility);
896 GV->setConstant(isConstantGlobal);
897 GV->setThreadLocal(IsThreadLocal);
898 InsertValue(GV, CurModule.Values);
902 // If this global has a name
904 // if the global we're parsing has an initializer (is a definition) and
905 // has external linkage.
906 if (Initializer && Linkage != GlobalValue::InternalLinkage)
907 // If there is already a global with external linkage with this name
908 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
909 // If we allow this GVar to get created, it will be renamed in the
910 // symbol table because it conflicts with an existing GVar. We can't
911 // allow redefinition of GVars whose linking indicates that their name
912 // must stay the same. Issue the error.
913 GenerateError("Redefinition of global variable named '" + Name +
914 "' of type '" + Ty->getDescription() + "'");
919 // Otherwise there is no existing GV to use, create one now.
921 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
922 CurModule.CurrentModule, IsThreadLocal);
923 GV->setVisibility(Visibility);
924 InsertValue(GV, CurModule.Values);
928 // setTypeName - Set the specified type to the name given. The name may be
929 // null potentially, in which case this is a noop. The string passed in is
930 // assumed to be a malloc'd string buffer, and is freed by this function.
932 // This function returns true if the type has already been defined, but is
933 // allowed to be redefined in the specified context. If the name is a new name
934 // for the type plane, it is inserted and false is returned.
935 static bool setTypeName(const Type *T, std::string *NameStr) {
936 assert(!inFunctionScope() && "Can't give types function-local names!");
937 if (NameStr == 0) return false;
939 std::string Name(*NameStr); // Copy string
940 delete NameStr; // Free old string
942 // We don't allow assigning names to void type
943 if (T == Type::VoidTy) {
944 GenerateError("Can't assign name '" + Name + "' to the void type");
948 // Set the type name, checking for conflicts as we do so.
949 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
951 if (AlreadyExists) { // Inserting a name that is already defined???
952 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
953 assert(Existing && "Conflict but no matching type?!");
955 // There is only one case where this is allowed: when we are refining an
956 // opaque type. In this case, Existing will be an opaque type.
957 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
958 // We ARE replacing an opaque type!
959 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
963 // Otherwise, this is an attempt to redefine a type. That's okay if
964 // the redefinition is identical to the original. This will be so if
965 // Existing and T point to the same Type object. In this one case we
966 // allow the equivalent redefinition.
967 if (Existing == T) return true; // Yes, it's equal.
969 // Any other kind of (non-equivalent) redefinition is an error.
970 GenerateError("Redefinition of type named '" + Name + "' of type '" +
971 T->getDescription() + "'");
977 //===----------------------------------------------------------------------===//
978 // Code for handling upreferences in type names...
981 // TypeContains - Returns true if Ty directly contains E in it.
983 static bool TypeContains(const Type *Ty, const Type *E) {
984 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
985 E) != Ty->subtype_end();
990 // NestingLevel - The number of nesting levels that need to be popped before
991 // this type is resolved.
992 unsigned NestingLevel;
994 // LastContainedTy - This is the type at the current binding level for the
995 // type. Every time we reduce the nesting level, this gets updated.
996 const Type *LastContainedTy;
998 // UpRefTy - This is the actual opaque type that the upreference is
1000 OpaqueType *UpRefTy;
1002 UpRefRecord(unsigned NL, OpaqueType *URTy)
1003 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1007 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1008 static std::vector<UpRefRecord> UpRefs;
1010 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1011 /// called. It loops through the UpRefs vector, which is a list of the
1012 /// currently active types. For each type, if the up reference is contained in
1013 /// the newly completed type, we decrement the level count. When the level
1014 /// count reaches zero, the upreferenced type is the type that is passed in:
1015 /// thus we can complete the cycle.
1017 static PATypeHolder HandleUpRefs(const Type *ty) {
1018 // If Ty isn't abstract, or if there are no up-references in it, then there is
1019 // nothing to resolve here.
1020 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1022 PATypeHolder Ty(ty);
1023 UR_OUT("Type '" << Ty->getDescription() <<
1024 "' newly formed. Resolving upreferences.\n" <<
1025 UpRefs.size() << " upreferences active!\n");
1027 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1028 // to zero), we resolve them all together before we resolve them to Ty. At
1029 // the end of the loop, if there is anything to resolve to Ty, it will be in
1031 OpaqueType *TypeToResolve = 0;
1033 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1034 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1035 << UpRefs[i].second->getDescription() << ") = "
1036 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1037 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1038 // Decrement level of upreference
1039 unsigned Level = --UpRefs[i].NestingLevel;
1040 UpRefs[i].LastContainedTy = Ty;
1041 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1042 if (Level == 0) { // Upreference should be resolved!
1043 if (!TypeToResolve) {
1044 TypeToResolve = UpRefs[i].UpRefTy;
1046 UR_OUT(" * Resolving upreference for "
1047 << UpRefs[i].second->getDescription() << "\n";
1048 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1049 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1050 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1051 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1053 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1054 --i; // Do not skip the next element...
1059 if (TypeToResolve) {
1060 UR_OUT(" * Resolving upreference for "
1061 << UpRefs[i].second->getDescription() << "\n";
1062 std::string OldName = TypeToResolve->getDescription());
1063 TypeToResolve->refineAbstractTypeTo(Ty);
1069 //===----------------------------------------------------------------------===//
1070 // RunVMAsmParser - Define an interface to this parser
1071 //===----------------------------------------------------------------------===//
1073 static Module* RunParser(Module * M);
1075 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1078 CurFilename = Filename;
1079 return RunParser(new Module(CurFilename));
1082 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1083 set_scan_string(AsmString);
1085 CurFilename = "from_memory";
1087 return RunParser(new Module (CurFilename));
1089 return RunParser(M);
1094 #line 957 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
1096 llvm::Module *ModuleVal;
1097 llvm::Function *FunctionVal;
1098 llvm::BasicBlock *BasicBlockVal;
1099 llvm::TerminatorInst *TermInstVal;
1100 llvm::Instruction *InstVal;
1101 llvm::Constant *ConstVal;
1103 const llvm::Type *PrimType;
1104 std::list<llvm::PATypeHolder> *TypeList;
1105 llvm::PATypeHolder *TypeVal;
1106 llvm::Value *ValueVal;
1107 std::vector<llvm::Value*> *ValueList;
1108 llvm::ArgListType *ArgList;
1109 llvm::TypeWithAttrs TypeWithAttrs;
1110 llvm::TypeWithAttrsList *TypeWithAttrsList;
1111 llvm::ValueRefList *ValueRefList;
1113 // Represent the RHS of PHI node
1114 std::list<std::pair<llvm::Value*,
1115 llvm::BasicBlock*> > *PHIList;
1116 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1117 std::vector<llvm::Constant*> *ConstVector;
1119 llvm::GlobalValue::LinkageTypes Linkage;
1120 llvm::GlobalValue::VisibilityTypes Visibility;
1121 uint16_t ParamAttrs;
1122 llvm::APInt *APIntVal;
1130 std::string *StrVal; // This memory must be deleted
1131 llvm::ValID ValIDVal;
1133 llvm::Instruction::BinaryOps BinaryOpVal;
1134 llvm::Instruction::TermOps TermOpVal;
1135 llvm::Instruction::MemoryOps MemOpVal;
1136 llvm::Instruction::CastOps CastOpVal;
1137 llvm::Instruction::OtherOps OtherOpVal;
1138 llvm::ICmpInst::Predicate IPredicate;
1139 llvm::FCmpInst::Predicate FPredicate;
1152 #define YYFLAG -32768
1153 #define YYNTBASE 153
1155 #define YYTRANSLATE(x) ((unsigned)(x) <= 392 ? yytranslate[x] : 234)
1157 static const short yytranslate[] = { 0,
1158 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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, 143,
1162 144, 141, 2, 140, 2, 2, 2, 2, 2, 2,
1163 2, 2, 2, 2, 2, 2, 2, 2, 2, 148,
1164 139, 149, 2, 2, 2, 2, 2, 2, 2, 2,
1165 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1166 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1167 145, 142, 147, 2, 2, 2, 2, 2, 152, 2,
1168 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1169 2, 2, 2, 2, 2, 2, 2, 2, 2, 146,
1170 2, 2, 150, 2, 151, 2, 2, 2, 2, 2,
1171 2, 2, 2, 2, 2, 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, 1, 3, 4, 5, 6,
1184 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1185 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1186 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1187 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1188 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1189 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1190 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1191 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1192 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1193 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1194 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1195 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1196 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1201 static const short yyprhs[] = { 0,
1202 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1203 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1204 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1205 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1206 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1207 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1208 120, 121, 124, 125, 127, 129, 131, 132, 135, 137,
1209 139, 141, 143, 145, 147, 149, 151, 152, 154, 156,
1210 158, 159, 161, 163, 164, 166, 168, 170, 172, 173,
1211 175, 177, 178, 180, 182, 184, 186, 188, 191, 193,
1212 195, 197, 199, 201, 202, 205, 207, 209, 211, 212,
1213 215, 216, 219, 220, 224, 227, 228, 230, 231, 235,
1214 237, 240, 242, 244, 246, 248, 250, 252, 255, 257,
1215 260, 266, 272, 278, 284, 288, 291, 297, 302, 305,
1216 307, 309, 311, 315, 317, 321, 323, 324, 326, 330,
1217 335, 339, 343, 348, 353, 357, 364, 370, 373, 376,
1218 379, 382, 385, 388, 391, 394, 397, 400, 403, 406,
1219 413, 419, 428, 435, 442, 450, 458, 465, 474, 483,
1220 487, 489, 491, 493, 495, 496, 499, 506, 508, 509,
1221 511, 514, 515, 519, 520, 524, 528, 532, 536, 537,
1222 545, 546, 555, 556, 565, 571, 574, 578, 580, 584,
1223 588, 592, 596, 598, 599, 605, 609, 611, 615, 617,
1224 618, 628, 630, 632, 637, 639, 641, 644, 648, 649,
1225 651, 653, 655, 657, 659, 661, 663, 665, 667, 671,
1226 673, 679, 681, 683, 685, 687, 689, 691, 694, 697,
1227 700, 704, 707, 708, 710, 713, 716, 720, 730, 740,
1228 749, 764, 766, 768, 775, 781, 784, 791, 799, 803,
1229 809, 810, 811, 815, 818, 820, 826, 832, 839, 846,
1230 851, 858, 863, 868, 875, 882, 885, 894, 896, 898,
1231 899, 903, 910, 914, 921, 924, 930, 938
1234 static const short yyrhs[] = { 70,
1235 0, 71, 0, 72, 0, 73, 0, 74, 0, 75,
1236 0, 76, 0, 77, 0, 78, 0, 82, 0, 83,
1237 0, 84, 0, 79, 0, 80, 0, 81, 0, 113,
1238 0, 114, 0, 115, 0, 116, 0, 117, 0, 118,
1239 0, 119, 0, 120, 0, 121, 0, 122, 0, 123,
1240 0, 124, 0, 87, 0, 88, 0, 89, 0, 90,
1241 0, 91, 0, 92, 0, 93, 0, 94, 0, 95,
1242 0, 96, 0, 97, 0, 98, 0, 99, 0, 100,
1243 0, 101, 0, 102, 0, 103, 0, 104, 0, 105,
1244 0, 106, 0, 93, 0, 94, 0, 95, 0, 96,
1245 0, 23, 0, 24, 0, 11, 0, 12, 0, 13,
1246 0, 16, 0, 19, 0, 21, 0, 160, 0, 0,
1247 160, 139, 0, 0, 17, 0, 20, 0, 165, 0,
1248 0, 163, 139, 0, 39, 0, 41, 0, 40, 0,
1249 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1250 0, 136, 0, 137, 0, 138, 0, 0, 43, 0,
1251 45, 0, 0, 39, 0, 40, 0, 41, 0, 44,
1252 0, 0, 41, 0, 39, 0, 0, 58, 0, 59,
1253 0, 60, 0, 61, 0, 62, 0, 57, 4, 0,
1254 114, 0, 115, 0, 132, 0, 133, 0, 135, 0,
1255 0, 174, 173, 0, 131, 0, 134, 0, 173, 0,
1256 0, 176, 175, 0, 0, 50, 4, 0, 0, 140,
1257 50, 4, 0, 31, 19, 0, 0, 179, 0, 0,
1258 140, 182, 181, 0, 179, 0, 50, 4, 0, 11,
1259 0, 12, 0, 13, 0, 14, 0, 46, 0, 183,
1260 0, 184, 141, 0, 218, 0, 142, 4, 0, 184,
1261 143, 188, 144, 176, 0, 10, 143, 188, 144, 176,
1262 0, 145, 4, 146, 184, 147, 0, 148, 4, 146,
1263 184, 149, 0, 150, 189, 151, 0, 150, 151, 0,
1264 148, 150, 189, 151, 149, 0, 148, 150, 151, 149,
1265 0, 184, 174, 0, 184, 0, 10, 0, 185, 0,
1266 187, 140, 185, 0, 187, 0, 187, 140, 36, 0,
1267 36, 0, 0, 184, 0, 189, 140, 184, 0, 184,
1268 145, 192, 147, 0, 184, 145, 147, 0, 184, 152,
1269 19, 0, 184, 148, 192, 149, 0, 184, 150, 192,
1270 151, 0, 184, 150, 151, 0, 184, 148, 150, 192,
1271 151, 149, 0, 184, 148, 150, 151, 149, 0, 184,
1272 37, 0, 184, 38, 0, 184, 218, 0, 184, 191,
1273 0, 184, 22, 0, 158, 3, 0, 158, 5, 0,
1274 158, 4, 0, 158, 6, 0, 11, 23, 0, 11,
1275 24, 0, 159, 9, 0, 155, 143, 190, 35, 184,
1276 144, 0, 112, 143, 190, 229, 144, 0, 126, 143,
1277 190, 140, 190, 140, 190, 144, 0, 153, 143, 190,
1278 140, 190, 144, 0, 154, 143, 190, 140, 190, 144,
1279 0, 85, 156, 143, 190, 140, 190, 144, 0, 86,
1280 157, 143, 190, 140, 190, 144, 0, 128, 143, 190,
1281 140, 190, 144, 0, 129, 143, 190, 140, 190, 140,
1282 190, 144, 0, 130, 143, 190, 140, 190, 140, 190,
1283 144, 0, 192, 140, 190, 0, 190, 0, 29, 0,
1284 30, 0, 34, 0, 0, 186, 218, 0, 118, 143,
1285 195, 35, 184, 144, 0, 197, 0, 0, 198, 0,
1286 197, 198, 0, 0, 28, 199, 214, 0, 0, 27,
1287 200, 215, 0, 55, 54, 204, 0, 162, 15, 184,
1288 0, 162, 15, 10, 0, 0, 164, 168, 194, 193,
1289 190, 201, 181, 0, 0, 164, 166, 168, 194, 193,
1290 190, 202, 181, 0, 0, 164, 167, 168, 194, 193,
1291 184, 203, 181, 0, 164, 168, 32, 171, 195, 0,
1292 48, 205, 0, 51, 139, 206, 0, 19, 0, 49,
1293 139, 19, 0, 63, 139, 19, 0, 145, 207, 147,
1294 0, 207, 140, 19, 0, 19, 0, 0, 208, 140,
1295 184, 174, 161, 0, 184, 174, 161, 0, 208, 0,
1296 208, 140, 36, 0, 36, 0, 0, 172, 186, 163,
1297 143, 209, 144, 176, 180, 177, 0, 25, 0, 150,
1298 0, 170, 168, 210, 211, 0, 26, 0, 151, 0,
1299 221, 213, 0, 169, 168, 210, 0, 0, 56, 0,
1300 3, 0, 4, 0, 9, 0, 23, 0, 24, 0,
1301 37, 0, 38, 0, 22, 0, 148, 192, 149, 0,
1302 191, 0, 54, 216, 19, 140, 19, 0, 7, 0,
1303 8, 0, 160, 0, 163, 0, 218, 0, 217, 0,
1304 184, 219, 0, 221, 222, 0, 212, 222, 0, 223,
1305 162, 224, 0, 223, 226, 0, 0, 18, 0, 64,
1306 220, 0, 64, 10, 0, 65, 14, 219, 0, 65,
1307 11, 219, 140, 14, 219, 140, 14, 219, 0, 66,
1308 158, 219, 140, 14, 219, 145, 225, 147, 0, 66,
1309 158, 219, 140, 14, 219, 145, 147, 0, 67, 172,
1310 186, 219, 143, 228, 144, 176, 35, 14, 219, 68,
1311 14, 219, 0, 68, 0, 69, 0, 225, 158, 217,
1312 140, 14, 219, 0, 158, 217, 140, 14, 219, 0,
1313 162, 231, 0, 184, 145, 219, 140, 219, 147, 0,
1314 227, 140, 145, 219, 140, 219, 147, 0, 184, 219,
1315 174, 0, 228, 140, 184, 219, 174, 0, 0, 0,
1316 229, 140, 220, 0, 53, 52, 0, 52, 0, 153,
1317 184, 219, 140, 219, 0, 154, 184, 219, 140, 219,
1318 0, 85, 156, 184, 219, 140, 219, 0, 86, 157,
1319 184, 219, 140, 219, 0, 155, 220, 35, 184, 0,
1320 126, 220, 140, 220, 140, 220, 0, 127, 220, 140,
1321 184, 0, 128, 220, 140, 220, 0, 129, 220, 140,
1322 220, 140, 220, 0, 130, 220, 140, 220, 140, 220,
1323 0, 125, 227, 0, 230, 172, 186, 219, 143, 228,
1324 144, 176, 0, 233, 0, 33, 0, 0, 107, 184,
1325 178, 0, 107, 184, 140, 11, 219, 178, 0, 108,
1326 184, 178, 0, 108, 184, 140, 11, 219, 178, 0,
1327 109, 220, 0, 232, 110, 184, 219, 178, 0, 232,
1328 111, 220, 140, 184, 219, 178, 0, 112, 184, 219,
1335 static const short yyrline[] = { 0,
1336 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1117,
1337 1117, 1117, 1117, 1117, 1117, 1118, 1118, 1118, 1118, 1118,
1338 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1122, 1122, 1123,
1339 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1130, 1130, 1131,
1340 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1135, 1135, 1136,
1341 1136, 1137, 1138, 1143, 1144, 1144, 1146, 1146, 1146, 1147,
1342 1147, 1151, 1155, 1160, 1160, 1162, 1163, 1168, 1174, 1175,
1343 1176, 1177, 1178, 1182, 1183, 1184, 1188, 1189, 1190, 1191,
1344 1195, 1196, 1197, 1201, 1202, 1203, 1204, 1205, 1209, 1210,
1345 1211, 1214, 1214, 1215, 1216, 1217, 1218, 1219, 1227, 1228,
1346 1229, 1230, 1231, 1234, 1235, 1240, 1241, 1242, 1245, 1246,
1347 1253, 1253, 1260, 1260, 1269, 1277, 1277, 1283, 1283, 1285,
1348 1290, 1303, 1303, 1303, 1303, 1306, 1310, 1314, 1321, 1326,
1349 1334, 1364, 1395, 1400, 1412, 1422, 1426, 1436, 1443, 1450,
1350 1457, 1462, 1467, 1474, 1475, 1482, 1489, 1497, 1503, 1515,
1351 1543, 1559, 1586, 1614, 1640, 1660, 1686, 1706, 1718, 1725,
1352 1791, 1801, 1811, 1817, 1827, 1833, 1843, 1848, 1853, 1861,
1353 1873, 1895, 1903, 1909, 1920, 1925, 1930, 1936, 1942, 1951,
1354 1955, 1963, 1963, 1966, 1966, 1969, 1980, 2001, 2006, 2014,
1355 2015, 2019, 2019, 2023, 2023, 2026, 2029, 2053, 2064, 2071,
1356 2074, 2080, 2083, 2090, 2094, 2113, 2116, 2122, 2132, 2136,
1357 2141, 2143, 2148, 2153, 2162, 2172, 2183, 2187, 2196, 2205,
1358 2210, 2331, 2331, 2333, 2342, 2342, 2344, 2349, 2361, 2365,
1359 2370, 2374, 2378, 2382, 2386, 2390, 2394, 2398, 2402, 2427,
1360 2431, 2441, 2445, 2449, 2454, 2461, 2461, 2467, 2476, 2480,
1361 2489, 2498, 2507, 2511, 2518, 2522, 2526, 2531, 2541, 2560,
1362 2569, 2649, 2653, 2660, 2671, 2684, 2694, 2705, 2715, 2724,
1363 2733, 2736, 2737, 2744, 2748, 2753, 2774, 2791, 2805, 2819,
1364 2831, 2839, 2846, 2852, 2858, 2864, 2879, 2964, 2969, 2973,
1365 2980, 2987, 2995, 3002, 3010, 3018, 3032, 3049
1370 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1372 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1373 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1374 "VOID","INTTYPE","FLOAT","DOUBLE","LABEL","TYPE","LOCALVAR","GLOBALVAR","LABELSTR",
1375 "STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT","ZEROINITIALIZER","TRUETOK",
1376 "FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE","GLOBAL","CONSTANT","SECTION",
1377 "ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT","NULL_TOK","UNDEF","INTERNAL",
1378 "LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE",
1379 "EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK","MODULE",
1380 "SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK","X86_STDCALLCC_TOK",
1381 "X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE","UNWIND","UNREACHABLE",
1382 "ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM","FREM","AND","OR","XOR",
1383 "SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT","SLE","SGE","ULT","UGT",
1384 "ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD","UNO","UEQ","UNE","MALLOC",
1385 "ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC","ZEXT","SEXT","FPTRUNC",
1386 "FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI","INTTOPTR","PTRTOINT",
1387 "PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT","SHUFFLEVECTOR",
1388 "NORETURN","INREG","SRET","NOUNWIND","NOALIAS","DEFAULT","HIDDEN","PROTECTED",
1389 "'='","','","'*'","'\\\\'","'('","')'","'['","'x'","']'","'<'","'>'","'{'","'}'",
1390 "'c'","ArithmeticOps","LogicalOps","CastOps","IPredicates","FPredicates","IntType",
1391 "FPType","LocalName","OptLocalName","OptLocalAssign","GlobalName","OptGlobalAssign",
1392 "GlobalAssign","GVInternalLinkage","GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage",
1393 "FunctionDefineLinkage","AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs",
1394 "FuncAttr","OptFuncAttrs","OptAlign","OptCAlign","SectionString","OptSection",
1395 "GlobalVarAttributes","GlobalVarAttribute","PrimType","Types","ArgType","ResultTypes",
1396 "ArgTypeList","ArgTypeListI","TypeListI","ConstVal","ConstExpr","ConstVector",
1397 "GlobalType","ThreadLocal","AliaseeRef","Module","DefinitionList","Definition",
1398 "@1","@2","@3","@4","@5","AsmBlock","TargetDefinition","LibrariesDefinition",
1399 "LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END",
1400 "Function","FunctionProto","OptSideEffect","ConstValueRef","SymbolicValueRef",
1401 "ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst",
1402 "JumpTable","Inst","PHIList","ValueRefList","IndexList","OptTailCall","InstVal",
1403 "OptVolatile","MemoryInst", NULL
1407 static const short yyr1[] = { 0,
1408 153, 153, 153, 153, 153, 153, 153, 153, 153, 154,
1409 154, 154, 154, 154, 154, 155, 155, 155, 155, 155,
1410 155, 155, 155, 155, 155, 155, 155, 156, 156, 156,
1411 156, 156, 156, 156, 156, 156, 156, 157, 157, 157,
1412 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1413 157, 157, 157, 158, 159, 159, 160, 160, 160, 161,
1414 161, 162, 162, 163, 163, 164, 164, 165, 166, 166,
1415 166, 166, 166, 167, 167, 167, 168, 168, 168, 168,
1416 169, 169, 169, 170, 170, 170, 170, 170, 171, 171,
1417 171, 172, 172, 172, 172, 172, 172, 172, 173, 173,
1418 173, 173, 173, 174, 174, 175, 175, 175, 176, 176,
1419 177, 177, 178, 178, 179, 180, 180, 181, 181, 182,
1420 182, 183, 183, 183, 183, 184, 184, 184, 184, 184,
1421 184, 184, 184, 184, 184, 184, 184, 184, 185, 186,
1422 186, 187, 187, 188, 188, 188, 188, 189, 189, 190,
1423 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
1424 190, 190, 190, 190, 190, 190, 190, 190, 190, 191,
1425 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1426 192, 193, 193, 194, 194, 195, 195, 196, 196, 197,
1427 197, 199, 198, 200, 198, 198, 198, 198, 201, 198,
1428 202, 198, 203, 198, 198, 198, 198, 204, 205, 205,
1429 206, 207, 207, 207, 208, 208, 209, 209, 209, 209,
1430 210, 211, 211, 212, 213, 213, 214, 215, 216, 216,
1431 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
1432 217, 218, 218, 218, 218, 219, 219, 220, 221, 221,
1433 222, 223, 223, 223, 224, 224, 224, 224, 224, 224,
1434 224, 224, 224, 225, 225, 226, 227, 227, 228, 228,
1435 228, 229, 229, 230, 230, 231, 231, 231, 231, 231,
1436 231, 231, 231, 231, 231, 231, 231, 231, 232, 232,
1437 233, 233, 233, 233, 233, 233, 233, 233
1440 static const short yyr2[] = { 0,
1441 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1442 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1443 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1444 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1446 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1447 0, 2, 0, 1, 1, 1, 0, 2, 1, 1,
1448 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
1449 0, 1, 1, 0, 1, 1, 1, 1, 0, 1,
1450 1, 0, 1, 1, 1, 1, 1, 2, 1, 1,
1451 1, 1, 1, 0, 2, 1, 1, 1, 0, 2,
1452 0, 2, 0, 3, 2, 0, 1, 0, 3, 1,
1453 2, 1, 1, 1, 1, 1, 1, 2, 1, 2,
1454 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
1455 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
1456 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
1457 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
1458 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
1459 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
1460 2, 0, 3, 0, 3, 3, 3, 3, 0, 7,
1461 0, 8, 0, 8, 5, 2, 3, 1, 3, 3,
1462 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
1463 9, 1, 1, 4, 1, 1, 2, 3, 0, 1,
1464 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1465 5, 1, 1, 1, 1, 1, 1, 2, 2, 2,
1466 3, 2, 0, 1, 2, 2, 3, 9, 9, 8,
1467 14, 1, 1, 6, 5, 2, 6, 7, 3, 5,
1468 0, 0, 3, 2, 1, 5, 5, 6, 6, 4,
1469 6, 4, 4, 6, 6, 2, 8, 1, 1, 0,
1470 3, 6, 3, 6, 2, 5, 7, 4
1473 static const short yydefact[] = { 67,
1474 57, 64, 58, 65, 59, 194, 192, 0, 0, 0,
1475 0, 0, 0, 77, 66, 67, 190, 81, 84, 0,
1476 0, 206, 0, 0, 62, 0, 68, 69, 71, 70,
1477 72, 74, 73, 75, 76, 78, 79, 80, 77, 77,
1478 185, 191, 82, 83, 77, 195, 85, 86, 87, 88,
1479 77, 253, 193, 253, 0, 0, 214, 207, 208, 196,
1480 242, 243, 198, 122, 123, 124, 125, 126, 0, 0,
1481 0, 0, 244, 245, 127, 197, 129, 185, 185, 89,
1482 184, 0, 92, 92, 254, 250, 63, 225, 226, 227,
1483 249, 209, 210, 213, 0, 147, 130, 0, 0, 0,
1484 0, 136, 148, 0, 128, 147, 0, 0, 91, 90,
1485 0, 182, 183, 0, 0, 93, 94, 95, 96, 97,
1486 0, 228, 0, 290, 252, 0, 211, 146, 104, 142,
1487 144, 0, 0, 0, 0, 0, 0, 135, 0, 0,
1488 0, 141, 0, 140, 0, 205, 122, 123, 124, 0,
1489 0, 0, 199, 98, 0, 222, 223, 224, 289, 275,
1490 0, 0, 0, 0, 92, 262, 263, 1, 2, 3,
1491 4, 5, 6, 7, 8, 9, 13, 14, 15, 10,
1492 11, 12, 0, 0, 0, 0, 0, 0, 16, 17,
1493 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1494 0, 0, 0, 0, 0, 0, 0, 0, 0, 251,
1495 92, 266, 0, 288, 212, 139, 0, 109, 0, 0,
1496 138, 0, 149, 109, 201, 203, 0, 186, 167, 168,
1497 163, 165, 164, 166, 169, 162, 158, 159, 0, 0,
1498 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1499 0, 0, 161, 160, 118, 0, 274, 256, 0, 255,
1500 0, 0, 54, 0, 0, 28, 29, 30, 31, 32,
1501 33, 34, 35, 36, 37, 0, 52, 53, 48, 49,
1502 50, 51, 38, 39, 40, 41, 42, 43, 44, 45,
1503 46, 47, 0, 113, 113, 295, 0, 0, 286, 0,
1504 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1505 99, 100, 101, 102, 103, 105, 145, 143, 132, 133,
1506 134, 137, 131, 118, 118, 0, 0, 0, 0, 0,
1507 0, 0, 0, 151, 181, 0, 0, 0, 155, 0,
1508 152, 0, 0, 0, 0, 200, 220, 231, 232, 233,
1509 238, 234, 235, 236, 237, 229, 0, 240, 247, 246,
1510 248, 0, 257, 0, 0, 0, 0, 0, 291, 0,
1511 293, 272, 0, 0, 0, 0, 0, 0, 0, 0,
1512 0, 0, 0, 0, 0, 106, 107, 108, 110, 202,
1513 204, 0, 0, 0, 272, 0, 0, 0, 0, 0,
1514 150, 136, 148, 0, 153, 154, 0, 0, 0, 0,
1515 0, 120, 118, 219, 104, 217, 0, 230, 0, 0,
1516 0, 0, 0, 0, 0, 0, 0, 0, 298, 0,
1517 0, 0, 282, 283, 0, 0, 0, 0, 280, 0,
1518 113, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1519 180, 157, 0, 0, 0, 0, 115, 121, 119, 61,
1520 0, 109, 0, 239, 0, 0, 271, 0, 0, 113,
1521 114, 113, 0, 0, 0, 0, 0, 0, 276, 277,
1522 271, 0, 296, 0, 187, 0, 0, 171, 0, 0,
1523 0, 0, 156, 0, 0, 0, 60, 216, 218, 104,
1524 116, 0, 0, 0, 0, 0, 278, 279, 292, 294,
1525 273, 0, 0, 281, 284, 285, 0, 113, 0, 0,
1526 0, 177, 0, 0, 173, 174, 170, 61, 117, 111,
1527 241, 0, 0, 104, 0, 109, 267, 0, 109, 297,
1528 175, 176, 0, 0, 0, 215, 0, 221, 0, 260,
1529 0, 0, 269, 0, 0, 268, 287, 172, 178, 179,
1530 112, 258, 0, 259, 0, 104, 0, 0, 0, 270,
1531 0, 0, 0, 0, 265, 0, 0, 264, 0, 261,
1535 static const short yydefgoto[] = { 250,
1536 251, 252, 276, 293, 150, 151, 73, 498, 12, 74,
1537 14, 15, 39, 40, 41, 45, 51, 111, 121, 316,
1538 216, 389, 319, 548, 369, 412, 530, 346, 413, 75,
1539 152, 130, 145, 131, 132, 104, 335, 358, 336, 114,
1540 82, 146, 581, 16, 17, 19, 18, 255, 324, 325,
1541 60, 22, 58, 95, 416, 417, 122, 158, 52, 90,
1542 53, 46, 419, 359, 77, 361, 260, 54, 86, 87,
1543 210, 552, 125, 299, 506, 429, 211, 212, 213, 214
1546 static const short yypact[] = { 1026,
1547 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -3, -63, 44,
1548 -10, 142, 62, 336,-32768, 1490,-32768, 107, 131, 74,
1549 127,-32768, -27, 149,-32768, 1195,-32768,-32768,-32768,-32768,
1550 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 93, 93,
1551 214,-32768,-32768,-32768, 93,-32768,-32768,-32768,-32768,-32768,
1552 93, 155,-32768, 13, 239, 253, 258,-32768,-32768,-32768,
1553 -32768,-32768, 139,-32768,-32768,-32768,-32768,-32768, 282, 284,
1554 5, 128,-32768,-32768,-32768, 124,-32768, 256, 256, 230,
1555 -32768, 34, 163, 163,-32768,-32768, 184,-32768,-32768,-32768,
1556 -32768,-32768,-32768,-32768, -30, 956,-32768, 147, 151, 910,
1557 139,-32768, 124, -74,-32768, 956, 34, 34,-32768,-32768,
1558 987,-32768,-32768, 1210, 302,-32768,-32768,-32768,-32768,-32768,
1559 1247,-32768, 15, 1353,-32768, 290,-32768,-32768, 124,-32768,
1560 170, 173, 1262, 1262, 162, -68, 1262,-32768, 174, 1210,
1561 1262, 139, 177, 124, 83,-32768, 38, 312, 314, 251,
1562 315, 764,-32768,-32768, 126,-32768,-32768,-32768,-32768,-32768,
1563 273, 1308, 227, 317, 163,-32768,-32768,-32768,-32768,-32768,
1564 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1565 -32768,-32768, 566, 613, 1262, 1262, 1262, 1262,-32768,-32768,
1566 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1567 1262, 1262, 1262, 1262, 1262, 1262, 1262, 1262, 1262,-32768,
1568 163,-32768, -4,-32768,-32768, -77, 1002,-32768, -59, 63,
1569 -32768, 182, 124,-32768,-32768, 124, 987,-32768,-32768,-32768,
1570 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 566, 613,
1571 189, 190, 191, 193, 194, 1100, 1354, 925, 319, 196,
1572 197, 198,-32768,-32768, 203, 199,-32768, 139, 611,-32768,
1573 741, 741,-32768, 741, 1247,-32768,-32768,-32768,-32768,-32768,
1574 -32768,-32768,-32768,-32768,-32768, 1262,-32768,-32768,-32768,-32768,
1575 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1576 -32768,-32768, 1262, 109, 119,-32768, 611, 94, 204, 206,
1577 207, 208, 209, 215, 611, 611, 321, 1247, 1262, 1262,
1578 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -82,-32768,
1579 -32768,-32768, -82, 203, 203, 323, 218, 220, 1210, 1210,
1580 1210, 1210, 1210,-32768,-32768, -21, 941, -92,-32768, -62,
1581 -32768, 1210, 1210, 1210, -5,-32768, 1146,-32768,-32768,-32768,
1582 -32768,-32768,-32768,-32768,-32768, 313, 1210,-32768,-32768,-32768,
1583 -32768, 228,-32768, 233, 741, 611, 611, 4,-32768, 17,
1584 -32768,-32768, 741, 225, 1262, 1262, 1262, 1262, 1262, 242,
1585 244, 1262, 741, 611, 245,-32768,-32768,-32768,-32768,-32768,
1586 -32768, 1262, 1210, 1210,-32768, 246, 247, 248, 249, 1210,
1587 -32768, 241, 764, -46,-32768,-32768, 252, 254, 358, 377,
1588 393,-32768, 203,-32768, 124, 259, 257,-32768, 379, -70,
1589 386, 388, 262, 266, 267, 741, 404, 741, 269, 271,
1590 741, 272, 124,-32768, 274, 276, 741, 741, 124, 270,
1591 283, 1262, 45, 287, 288, 70, 1210, 1210, 1210, 1210,
1592 -32768,-32768, 275, 1210, 1210, 1262,-32768,-32768,-32768, 76,
1593 1164,-32768, 289,-32768, 741, 741, 1262, 741, 741, 283,
1594 -32768, 283, 1262, 741, 294, 1262, 1262, 1262,-32768,-32768,
1595 1262, 372,-32768, 611,-32768, 1210, 1210,-32768, 295, 286,
1596 298, 299,-32768, 297, 300, 164,-32768,-32768,-32768, 124,
1597 84, 424, 305, 301, 611, 92,-32768,-32768,-32768,-32768,
1598 -32768, 303, 741,-32768,-32768,-32768, 103, 283, 310, 311,
1599 1210,-32768, 1210, 1210,-32768,-32768,-32768, 76,-32768, 397,
1600 -32768, 435, 6,-32768, 1262,-32768,-32768, 320,-32768,-32768,
1601 -32768,-32768, 318, 322, 324,-32768, 455,-32768, 741,-32768,
1602 476, 7, -77, 611, -1,-32768, -82,-32768,-32768,-32768,
1603 -32768,-32768, 329,-32768, 476,-32768, 447, 456, 335, -77,
1604 741, 741, 462, 409,-32768, 741, 464,-32768, 741,-32768,
1608 static const short yypgoto[] = { 362,
1609 363, 364, 250, 261, -161,-32768, 0, -38, 406, 14,
1610 -32768,-32768,-32768,-32768, 29,-32768,-32768,-32768, -146, -294,
1611 -407,-32768, -220,-32768, -285, 1,-32768, -289,-32768,-32768,
1612 -25, 279, -114,-32768, 385, 403, -29, -150, -236, 167,
1613 202, 277,-32768,-32768, 481,-32768,-32768,-32768,-32768,-32768,
1614 -32768,-32768,-32768,-32768,-32768,-32768, 421,-32768,-32768,-32768,
1615 -32768,-32768,-32768, -492, -139, 98, -182,-32768, 452,-32768,
1616 -32768,-32768,-32768,-32768, 26, 113,-32768,-32768,-32768,-32768
1623 static const short yytable[] = { 11,
1624 76, 253, 264, 323, 296, 228, 155, 460, 99, 371,
1625 338, 340, 254, 13, 426, 11, 263, 263, 265, 300,
1626 301, 302, 303, 304, 388, 410, 307, 428, 388, 13,
1627 85, 311, 312, 567, 390, 391, 311, 312, 88, 156,
1628 -54, -54, -54, -54, 411, 20, 103, 400, 386, 313,
1629 314, 387, 315, 427, 313, 314, 405, 315, 563, 21,
1630 229, 230, 112, 113, 308, 137, 427, 78, 79, 400,
1631 129, 137, 569, 83, 103, 23, 138, 400, 464, 84,
1632 129, 105, 222, 106, 153, 144, 11, 320, 406, 61,
1633 62, 1, 528, 400, 3, 144, 5, 24, 1, 2,
1634 404, 3, 4, 5, 453, 309, 310, 219, 220, 126,
1635 225, 223, 311, 312, 410, 226, 127, 57, 400, 360,
1636 420, 360, 360, 459, 360, 401, 553, 385, 25, 386,
1637 313, 314, 387, 315, 61, 62, 259, 101, 64, 65,
1638 66, 67, 2, 1, 2, 4, 3, 4, 5, 43,
1639 365, 44, 550, 564, 100, 483, 26, 360, 570, 294,
1640 295, 259, 297, 89, 157, 360, 360, 59, 256, 47,
1641 48, 49, 85, 68, 50, 298, 259, 259, 259, 259,
1642 259, 305, 306, 259, 509, 105, 510, 106, 485, 311,
1643 312, 129, 432, 383, 434, 435, 436, 311, 312, 1,
1644 27, 144, 3, 105, 5, 106, 388, 313, 314, 473,
1645 315, 321, 55, 488, 386, 313, 314, 387, 315, 115,
1646 116, 117, 118, 119, 120, 360, 360, 360, 36, 37,
1647 38, 535, 540, 360, 105, 536, 106, 261, 373, 144,
1648 262, 501, 535, 360, 360, 80, 539, 81, 368, 105,
1649 366, 106, 253, 231, 232, 233, 234, 92, 370, 105,
1650 388, 106, 388, 254, 105, 56, 106, 367, 109, 69,
1651 110, 93, 70, 140, 141, 71, 94, 72, 102, 107,
1652 108, 96, 144, 384, 259, 97, 360, 98, 360, 81,
1653 511, 360, 133, 514, 515, 516, 134, 360, 360, 395,
1654 396, 397, 398, 399, 105, 154, 106, 527, 215, 217,
1655 221, 403, 407, 408, 409, 555, 218, 224, 557, 227,
1656 -55, 415, -56, 235, 257, 360, 360, 263, 360, 360,
1657 322, 329, 330, 331, 360, 332, 333, 341, 342, 343,
1658 344, 347, 345, 374, 360, 375, 376, 377, 378, 259,
1659 433, 259, 259, 259, 379, 382, 439, 392, 362, 363,
1660 393, 364, 394, 444, 445, 360, 443, 421, 418, 431,
1661 451, 551, 422, 360, 28, 29, 30, 31, 32, 33,
1662 34, 437, 35, 438, 442, 447, 448, 449, 450, 452,
1663 565, 454, 456, 455, 372, 457, 458, 463, 461, 465,
1664 462, 466, 380, 381, 467, 468, 469, 471, 473, 360,
1665 474, 476, 481, 477, 360, 478, 484, 489, 490, 491,
1666 492, 427, 482, 493, 494, 495, 486, 487, 502, 522,
1667 496, 360, 360, 513, 521, 500, 360, 523, 524, 360,
1668 525, 505, 531, 526, 532, 533, 547, 259, 549, 537,
1669 259, 259, 259, 541, 542, 505, 519, 520, 561, 497,
1670 571, 558, 423, 424, 425, 559, 556, 560, 568, 572,
1671 430, 36, 37, 38, 573, 576, 577, 579, 348, 349,
1672 440, 441, 582, 583, 350, 207, 208, 209, 327, 546,
1673 139, 543, 124, 544, 545, 318, 42, 351, 352, 353,
1674 328, 529, 136, 326, 123, 91, 517, 446, 0, 554,
1675 0, 0, 354, 355, 0, 0, 0, 0, 0, 0,
1676 0, 0, 0, 470, 0, 472, 0, 497, 475, 356,
1677 0, 0, 0, 0, 479, 480, 0, 0, 0, 0,
1678 0, 0, 0, 0, 0, 168, 169, 170, 171, 172,
1679 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1680 239, 240, 503, 504, 0, 507, 508, 0, 0, 0,
1681 0, 512, 0, 0, 0, 0, 0, 0, 0, 0,
1682 0, 518, 0, 0, 0, 0, 0, 241, 189, 190,
1683 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
1684 0, 242, 534, 243, 244, 245, 0, 0, 0, 0,
1685 538, 0, 0, 348, 349, 0, 0, 61, 62, 350,
1686 0, 0, 0, 357, 0, 0, 1, 2, 0, 3,
1687 4, 5, 351, 352, 353, 277, 278, 0, 0, 0,
1688 0, 0, 0, 0, 0, 0, 562, 354, 355, 0,
1689 0, 566, 266, 267, 268, 269, 270, 271, 272, 273,
1690 274, 275, 0, 0, 356, 0, 0, 0, 574, 575,
1691 0, 0, 0, 578, 0, 0, 580, 0, 0, 0,
1692 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
1693 178, 179, 180, 181, 182, 239, 240, 0, 0, 0,
1694 0, 0, 0, 0, 0, 279, 280, 281, 282, 283,
1695 284, 285, 286, 287, 288, 289, 290, 291, 292, 0,
1696 0, 0, 241, 189, 190, 191, 192, 193, 194, 195,
1697 196, 197, 198, 199, 200, 0, 242, 0, 243, 244,
1698 245, 0, 0, 348, 349, 0, 0, 61, 62, 350,
1699 0, 105, 0, 106, 0, 0, 1, 2, 357, 3,
1700 4, 5, 351, 352, 353, 0, 0, 0, 0, 0,
1701 61, 62, 0, 0, 0, 0, 0, 354, 355, 1,
1702 2, 0, 3, 4, 5, 236, 0, 0, 0, 0,
1703 0, 0, 0, 0, 356, 0, 0, 0, 0, 0,
1704 237, 238, 0, 0, 0, 0, 0, 0, 0, 0,
1705 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
1706 178, 179, 180, 181, 182, 239, 240, 0, 0, 0,
1707 0, 0, 0, 168, 169, 170, 171, 172, 173, 174,
1708 175, 176, 177, 178, 179, 180, 181, 182, 239, 240,
1709 0, 0, 241, 189, 190, 191, 192, 193, 194, 195,
1710 196, 197, 198, 199, 200, 0, 242, 0, 243, 244,
1711 245, 0, 0, 0, 0, 241, 189, 190, 191, 192,
1712 193, 194, 195, 196, 197, 198, 199, 200, 357, 242,
1713 0, 243, 244, 245, 0, 0, 0, 0, 0, 0,
1714 0, 0, 0, 0, 105, 0, 106, 0, 246, 0,
1715 0, 247, 0, 248, 0, 249, 61, 62, 0, 101,
1716 64, 65, 66, 67, 0, 1, 2, 0, 3, 4,
1717 5, 61, 62, 0, 101, 147, 148, 149, 67, 0,
1718 1, 2, 0, 3, 4, 5, 0, 61, 62, 0,
1719 101, 147, 148, 149, 67, 68, 1, 2, 0, 3,
1720 4, 5, 61, 62, 0, 101, 64, 65, 66, 67,
1721 68, 1, 2, 0, 3, 4, 5, 0, 0, 0,
1722 0, 0, 0, 0, 0, 0, 68, 0, 0, 0,
1723 0, 128, 0, 61, 62, 0, 142, 64, 65, 66,
1724 67, 68, 1, 2, 0, 3, 4, 5, 61, 62,
1725 0, 101, 64, 65, 66, 67, 0, 1, 2, 0,
1726 3, 4, 5, 0, 0, -189, 0, 0, 0, 0,
1727 0, 0, 68, 0, 0, 0, 0, 317, 0, 0,
1728 -63, 1, 2, 0, 3, 4, 5, 68, 0, 0,
1729 0, 69, 6, 7, 70, 0, 0, 71, 0, 72,
1730 135, 0, 0, 0, 0, 0, 69, 0, 0, 70,
1731 0, 0, 71, 8, 72, 339, 9, 0, 0, 0,
1732 10, 0, 69, 0, 0, 70, 0, 0, 71, 0,
1733 72, 402, 0, 0, 0, 0, 0, 69, 0, 0,
1734 70, 0, 0, 71, 143, 72, 61, 62, 0, 101,
1735 147, 148, 149, 67, 0, 1, 2, 0, 3, 4,
1736 5, 0, 0, 0, 0, 0, 0, 0, 69, 0,
1737 0, 70, 0, 0, 71, 0, 72, 0, 0, 0,
1738 0, 0, 0, 69, 0, 68, 70, 0, 0, 71,
1739 0, 72, 61, 62, 0, 101, 64, 65, 66, 67,
1740 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
1741 61, 62, 0, 101, 64, 65, 66, 67, 0, 1,
1742 2, 414, 3, 4, 5, 0, 0, 0, 0, 0,
1743 0, 68, 0, 0, 0, 0, 0, 0, 0, 499,
1744 0, 61, 62, 0, 63, 64, 65, 66, 67, 68,
1745 1, 2, 0, 3, 4, 5, 61, 62, 0, 101,
1746 147, 148, 149, 67, 0, 1, 2, 0, 3, 4,
1747 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1748 68, 69, 0, 0, 70, 0, 334, 71, 0, 72,
1749 0, 0, 0, 61, 62, 68, 142, 64, 65, 66,
1750 67, 0, 1, 2, 0, 3, 4, 5, 61, 62,
1751 0, 101, 64, 65, 66, 67, 0, 1, 2, 0,
1752 3, 4, 5, 0, 0, 0, 0, 69, 0, 0,
1753 70, 0, 68, 71, 0, 72, 0, 0, 0, 0,
1754 0, 0, 0, 0, 0, 69, 0, 68, 70, 0,
1755 0, 71, 0, 72, 61, 62, 0, 258, 64, 65,
1756 66, 67, 0, 1, 2, 0, 3, 4, 5, 0,
1757 0, 0, 0, 0, 0, 0, 69, 0, 0, 70,
1758 0, 0, 71, 0, 72, 0, 0, 0, 0, 0,
1759 0, 69, 0, 68, 70, 0, 0, 71, 0, 72,
1760 61, 62, 0, 101, 147, 148, 149, 67, 0, 1,
1761 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
1762 0, 0, 0, 0, 0, 159, 0, 0, 69, 0,
1763 0, 70, 0, 0, 71, 0, 72, 0, 0, 68,
1764 0, 0, 0, 69, 160, 161, 70, 0, 0, 71,
1765 0, 72, 0, 0, 0, 0, 162, 163, 164, 165,
1766 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
1767 176, 177, 178, 179, 180, 181, 182, 183, 184, 0,
1768 0, 0, 0, 0, 0, 0, 0, 0, 0, 69,
1769 0, 0, 70, 0, 0, 71, 0, 72, 0, 185,
1770 186, 187, 0, 0, 188, 189, 190, 191, 192, 193,
1771 194, 195, 196, 197, 198, 199, 200, 201, 202, 203,
1772 204, 205, 206, 0, 0, 0, 0, 0, 0, -188,
1773 0, 0, 0, 0, 0, 69, 0, 0, 70, 0,
1774 0, 71, 0, 337, -63, 1, 2, 0, 3, 4,
1775 5, 0, 0, 0, 0, 0, 6, 7, 0, 0,
1776 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1777 0, 0, 0, 0, 0, 0, 0, 8, 0, 0,
1781 static const short yycheck[] = { 0,
1782 26, 152, 164, 224, 187, 145, 121, 415, 4, 295,
1783 247, 248, 152, 0, 11, 16, 11, 11, 165, 202,
1784 203, 204, 205, 206, 319, 31, 209, 11, 323, 16,
1785 18, 114, 115, 35, 324, 325, 114, 115, 26, 25,
1786 3, 4, 5, 6, 50, 49, 72, 140, 131, 132,
1787 133, 134, 135, 50, 132, 133, 149, 135, 551, 63,
1788 23, 24, 29, 30, 211, 140, 50, 39, 40, 140,
1789 96, 140, 565, 45, 100, 139, 151, 140, 149, 51,
1790 106, 141, 151, 143, 114, 111, 87, 147, 151, 7,
1791 8, 16, 500, 140, 19, 121, 21, 54, 16, 17,
1792 337, 19, 20, 21, 151, 110, 111, 133, 134, 140,
1793 140, 137, 114, 115, 31, 141, 147, 145, 140, 259,
1794 357, 261, 262, 413, 264, 147, 534, 310, 139, 131,
1795 132, 133, 134, 135, 7, 8, 162, 10, 11, 12,
1796 13, 14, 17, 16, 17, 20, 19, 20, 21, 43,
1797 265, 45, 147, 147, 150, 441, 15, 297, 566, 185,
1798 186, 187, 188, 151, 150, 305, 306, 19, 155, 39,
1799 40, 41, 18, 46, 44, 201, 202, 203, 204, 205,
1800 206, 207, 208, 209, 470, 141, 472, 143, 144, 114,
1801 115, 217, 375, 308, 377, 378, 379, 114, 115, 16,
1802 139, 227, 19, 141, 21, 143, 501, 132, 133, 140,
1803 135, 149, 139, 144, 131, 132, 133, 134, 135, 57,
1804 58, 59, 60, 61, 62, 365, 366, 367, 136, 137,
1805 138, 140, 518, 373, 141, 144, 143, 11, 145, 265,
1806 14, 462, 140, 383, 384, 32, 144, 34, 140, 141,
1807 276, 143, 403, 3, 4, 5, 6, 19, 140, 141,
1808 555, 143, 557, 403, 141, 139, 143, 293, 39, 142,
1809 41, 19, 145, 107, 108, 148, 19, 150, 151, 78,
1810 79, 143, 308, 309, 310, 4, 426, 4, 428, 34,
1811 473, 431, 146, 476, 477, 478, 146, 437, 438, 329,
1812 330, 331, 332, 333, 141, 4, 143, 144, 19, 140,
1813 149, 337, 342, 343, 344, 536, 144, 144, 539, 143,
1814 9, 347, 9, 9, 52, 465, 466, 11, 468, 469,
1815 149, 143, 143, 143, 474, 143, 143, 19, 143, 143,
1816 143, 143, 140, 140, 484, 140, 140, 140, 140, 375,
1817 376, 377, 378, 379, 140, 35, 382, 35, 261, 262,
1818 143, 264, 143, 393, 394, 505, 392, 140, 56, 145,
1819 400, 533, 140, 513, 39, 40, 41, 42, 43, 44,
1820 45, 140, 47, 140, 140, 140, 140, 140, 140, 149,
1821 552, 140, 35, 140, 297, 19, 4, 19, 140, 14,
1822 144, 14, 305, 306, 143, 140, 140, 4, 140, 549,
1823 140, 140, 143, 140, 554, 140, 442, 447, 448, 449,
1824 450, 50, 140, 149, 454, 455, 140, 140, 140, 144,
1825 456, 571, 572, 140, 140, 461, 576, 140, 140, 579,
1826 144, 467, 19, 144, 140, 145, 50, 473, 14, 147,
1827 476, 477, 478, 144, 144, 481, 486, 487, 4, 460,
1828 14, 144, 365, 366, 367, 144, 147, 144, 140, 14,
1829 373, 136, 137, 138, 140, 14, 68, 14, 3, 4,
1830 383, 384, 0, 0, 9, 124, 124, 124, 239, 528,
1831 106, 521, 87, 523, 524, 217, 16, 22, 23, 24,
1832 240, 501, 100, 227, 84, 54, 481, 395, -1, 535,
1833 -1, -1, 37, 38, -1, -1, -1, -1, -1, -1,
1834 -1, -1, -1, 426, -1, 428, -1, 528, 431, 54,
1835 -1, -1, -1, -1, 437, 438, -1, -1, -1, -1,
1836 -1, -1, -1, -1, -1, 70, 71, 72, 73, 74,
1837 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1838 85, 86, 465, 466, -1, 468, 469, -1, -1, -1,
1839 -1, 474, -1, -1, -1, -1, -1, -1, -1, -1,
1840 -1, 484, -1, -1, -1, -1, -1, 112, 113, 114,
1841 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1842 -1, 126, 505, 128, 129, 130, -1, -1, -1, -1,
1843 513, -1, -1, 3, 4, -1, -1, 7, 8, 9,
1844 -1, -1, -1, 148, -1, -1, 16, 17, -1, 19,
1845 20, 21, 22, 23, 24, 23, 24, -1, -1, -1,
1846 -1, -1, -1, -1, -1, -1, 549, 37, 38, -1,
1847 -1, 554, 87, 88, 89, 90, 91, 92, 93, 94,
1848 95, 96, -1, -1, 54, -1, -1, -1, 571, 572,
1849 -1, -1, -1, 576, -1, -1, 579, -1, -1, -1,
1850 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
1851 80, 81, 82, 83, 84, 85, 86, -1, -1, -1,
1852 -1, -1, -1, -1, -1, 93, 94, 95, 96, 97,
1853 98, 99, 100, 101, 102, 103, 104, 105, 106, -1,
1854 -1, -1, 112, 113, 114, 115, 116, 117, 118, 119,
1855 120, 121, 122, 123, 124, -1, 126, -1, 128, 129,
1856 130, -1, -1, 3, 4, -1, -1, 7, 8, 9,
1857 -1, 141, -1, 143, -1, -1, 16, 17, 148, 19,
1858 20, 21, 22, 23, 24, -1, -1, -1, -1, -1,
1859 7, 8, -1, -1, -1, -1, -1, 37, 38, 16,
1860 17, -1, 19, 20, 21, 22, -1, -1, -1, -1,
1861 -1, -1, -1, -1, 54, -1, -1, -1, -1, -1,
1862 37, 38, -1, -1, -1, -1, -1, -1, -1, -1,
1863 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
1864 80, 81, 82, 83, 84, 85, 86, -1, -1, -1,
1865 -1, -1, -1, 70, 71, 72, 73, 74, 75, 76,
1866 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1867 -1, -1, 112, 113, 114, 115, 116, 117, 118, 119,
1868 120, 121, 122, 123, 124, -1, 126, -1, 128, 129,
1869 130, -1, -1, -1, -1, 112, 113, 114, 115, 116,
1870 117, 118, 119, 120, 121, 122, 123, 124, 148, 126,
1871 -1, 128, 129, 130, -1, -1, -1, -1, -1, -1,
1872 -1, -1, -1, -1, 141, -1, 143, -1, 145, -1,
1873 -1, 148, -1, 150, -1, 152, 7, 8, -1, 10,
1874 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
1875 21, 7, 8, -1, 10, 11, 12, 13, 14, -1,
1876 16, 17, -1, 19, 20, 21, -1, 7, 8, -1,
1877 10, 11, 12, 13, 14, 46, 16, 17, -1, 19,
1878 20, 21, 7, 8, -1, 10, 11, 12, 13, 14,
1879 46, 16, 17, -1, 19, 20, 21, -1, -1, -1,
1880 -1, -1, -1, -1, -1, -1, 46, -1, -1, -1,
1881 -1, 36, -1, 7, 8, -1, 10, 11, 12, 13,
1882 14, 46, 16, 17, -1, 19, 20, 21, 7, 8,
1883 -1, 10, 11, 12, 13, 14, -1, 16, 17, -1,
1884 19, 20, 21, -1, -1, 0, -1, -1, -1, -1,
1885 -1, -1, 46, -1, -1, -1, -1, 36, -1, -1,
1886 15, 16, 17, -1, 19, 20, 21, 46, -1, -1,
1887 -1, 142, 27, 28, 145, -1, -1, 148, -1, 150,
1888 151, -1, -1, -1, -1, -1, 142, -1, -1, 145,
1889 -1, -1, 148, 48, 150, 151, 51, -1, -1, -1,
1890 55, -1, 142, -1, -1, 145, -1, -1, 148, -1,
1891 150, 151, -1, -1, -1, -1, -1, 142, -1, -1,
1892 145, -1, -1, 148, 118, 150, 7, 8, -1, 10,
1893 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
1894 21, -1, -1, -1, -1, -1, -1, -1, 142, -1,
1895 -1, 145, -1, -1, 148, -1, 150, -1, -1, -1,
1896 -1, -1, -1, 142, -1, 46, 145, -1, -1, 148,
1897 -1, 150, 7, 8, -1, 10, 11, 12, 13, 14,
1898 -1, 16, 17, -1, 19, 20, 21, -1, -1, -1,
1899 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
1900 17, 36, 19, 20, 21, -1, -1, -1, -1, -1,
1901 -1, 46, -1, -1, -1, -1, -1, -1, -1, 36,
1902 -1, 7, 8, -1, 10, 11, 12, 13, 14, 46,
1903 16, 17, -1, 19, 20, 21, 7, 8, -1, 10,
1904 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
1905 21, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1906 46, 142, -1, -1, 145, -1, 147, 148, -1, 150,
1907 -1, -1, -1, 7, 8, 46, 10, 11, 12, 13,
1908 14, -1, 16, 17, -1, 19, 20, 21, 7, 8,
1909 -1, 10, 11, 12, 13, 14, -1, 16, 17, -1,
1910 19, 20, 21, -1, -1, -1, -1, 142, -1, -1,
1911 145, -1, 46, 148, -1, 150, -1, -1, -1, -1,
1912 -1, -1, -1, -1, -1, 142, -1, 46, 145, -1,
1913 -1, 148, -1, 150, 7, 8, -1, 10, 11, 12,
1914 13, 14, -1, 16, 17, -1, 19, 20, 21, -1,
1915 -1, -1, -1, -1, -1, -1, 142, -1, -1, 145,
1916 -1, -1, 148, -1, 150, -1, -1, -1, -1, -1,
1917 -1, 142, -1, 46, 145, -1, -1, 148, -1, 150,
1918 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
1919 17, -1, 19, 20, 21, -1, -1, -1, -1, -1,
1920 -1, -1, -1, -1, -1, 33, -1, -1, 142, -1,
1921 -1, 145, -1, -1, 148, -1, 150, -1, -1, 46,
1922 -1, -1, -1, 142, 52, 53, 145, -1, -1, 148,
1923 -1, 150, -1, -1, -1, -1, 64, 65, 66, 67,
1924 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1925 78, 79, 80, 81, 82, 83, 84, 85, 86, -1,
1926 -1, -1, -1, -1, -1, -1, -1, -1, -1, 142,
1927 -1, -1, 145, -1, -1, 148, -1, 150, -1, 107,
1928 108, 109, -1, -1, 112, 113, 114, 115, 116, 117,
1929 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1930 128, 129, 130, -1, -1, -1, -1, -1, -1, 0,
1931 -1, -1, -1, -1, -1, 142, -1, -1, 145, -1,
1932 -1, 148, -1, 150, 15, 16, 17, -1, 19, 20,
1933 21, -1, -1, -1, -1, -1, 27, 28, -1, -1,
1934 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1935 -1, -1, -1, -1, -1, -1, -1, 48, -1, -1,
1938 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1939 #line 3 "/usr/share/bison.simple"
1940 /* This file comes from bison-1.28. */
1942 /* Skeleton output parser for bison,
1943 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1945 This program is free software; you can redistribute it and/or modify
1946 it under the terms of the GNU General Public License as published by
1947 the Free Software Foundation; either version 2, or (at your option)
1950 This program is distributed in the hope that it will be useful,
1951 but WITHOUT ANY WARRANTY; without even the implied warranty of
1952 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1953 GNU General Public License for more details.
1955 You should have received a copy of the GNU General Public License
1956 along with this program; if not, write to the Free Software
1957 Foundation, Inc., 59 Temple Place - Suite 330,
1958 Boston, MA 02111-1307, USA. */
1960 /* As a special exception, when this file is copied by Bison into a
1961 Bison output file, you may use that output file without restriction.
1962 This special exception was added by the Free Software Foundation
1963 in version 1.24 of Bison. */
1965 /* This is the parser code that is written into each bison parser
1966 when the %semantic_parser declaration is not specified in the grammar.
1967 It was written by Richard Stallman by simplifying the hairy parser
1968 used when %semantic_parser is specified. */
1970 #ifndef YYSTACK_USE_ALLOCA
1972 #define YYSTACK_USE_ALLOCA
1973 #else /* alloca not defined */
1975 #define YYSTACK_USE_ALLOCA
1976 #define alloca __builtin_alloca
1977 #else /* not GNU C. */
1978 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
1979 #define YYSTACK_USE_ALLOCA
1981 #else /* not sparc */
1982 /* We think this test detects Watcom and Microsoft C. */
1983 /* This used to test MSDOS, but that is a bad idea
1984 since that symbol is in the user namespace. */
1985 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
1986 #if 0 /* No need for malloc.h, which pollutes the namespace;
1987 instead, just don't use alloca. */
1990 #else /* not MSDOS, or __TURBOC__ */
1992 /* I don't know what this was needed for, but it pollutes the namespace.
1993 So I turned it off. rms, 2 May 1997. */
1994 /* #include <malloc.h> */
1996 #define YYSTACK_USE_ALLOCA
1997 #else /* not MSDOS, or __TURBOC__, or _AIX */
1999 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2000 and on HPUX 10. Eventually we can turn this on. */
2001 #define YYSTACK_USE_ALLOCA
2002 #define alloca __builtin_alloca
2005 #endif /* not _AIX */
2006 #endif /* not MSDOS, or __TURBOC__ */
2007 #endif /* not sparc */
2008 #endif /* not GNU C */
2009 #endif /* alloca not defined */
2010 #endif /* YYSTACK_USE_ALLOCA not defined */
2012 #ifdef YYSTACK_USE_ALLOCA
2013 #define YYSTACK_ALLOC alloca
2015 #define YYSTACK_ALLOC malloc
2018 /* Note: there must be only one dollar sign in this file.
2019 It is replaced by the list of actions, each action
2020 as one case of the switch. */
2022 #define yyerrok (yyerrstatus = 0)
2023 #define yyclearin (yychar = YYEMPTY)
2026 #define YYACCEPT goto yyacceptlab
2027 #define YYABORT goto yyabortlab
2028 #define YYERROR goto yyerrlab1
2029 /* Like YYERROR except do call yyerror.
2030 This remains here temporarily to ease the
2031 transition to the new meaning of YYERROR, for GCC.
2032 Once GCC version 2 has supplanted version 1, this can go. */
2033 #define YYFAIL goto yyerrlab
2034 #define YYRECOVERING() (!!yyerrstatus)
2035 #define YYBACKUP(token, value) \
2037 if (yychar == YYEMPTY && yylen == 1) \
2038 { yychar = (token), yylval = (value); \
2039 yychar1 = YYTRANSLATE (yychar); \
2044 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2048 #define YYERRCODE 256
2051 #define YYLEX yylex()
2057 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2059 #define YYLEX yylex(&yylval, &yylloc)
2061 #else /* not YYLSP_NEEDED */
2063 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2065 #define YYLEX yylex(&yylval)
2067 #endif /* not YYLSP_NEEDED */
2070 /* If nonreentrant, generate the variables here */
2074 int yychar; /* the lookahead symbol */
2075 YYSTYPE yylval; /* the semantic value of the */
2076 /* lookahead symbol */
2079 YYLTYPE yylloc; /* location data for the lookahead */
2083 int yynerrs; /* number of parse errors so far */
2084 #endif /* not YYPURE */
2087 int yydebug; /* nonzero means print parse trace */
2088 /* Since this is uninitialized, it does not stop multiple parsers
2092 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2095 #define YYINITDEPTH 200
2098 /* YYMAXDEPTH is the maximum size the stacks can grow to
2099 (effective only if the built-in stack extension method is used). */
2106 #define YYMAXDEPTH 10000
2109 /* Define __yy_memcpy. Note that the size argument
2110 should be passed with type unsigned int, because that is what the non-GCC
2111 definitions require. With GCC, __builtin_memcpy takes an arg
2112 of type size_t, but it can handle unsigned int. */
2114 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2115 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2116 #else /* not GNU C or C++ */
2119 /* This is the most reliable way to avoid incompatibilities
2120 in available built-in functions on various systems. */
2122 __yy_memcpy (to, from, count)
2127 register char *f = from;
2128 register char *t = to;
2129 register int i = count;
2135 #else /* __cplusplus */
2137 /* This is the most reliable way to avoid incompatibilities
2138 in available built-in functions on various systems. */
2140 __yy_memcpy (char *to, char *from, unsigned int count)
2142 register char *t = to;
2143 register char *f = from;
2144 register int i = count;
2153 #line 217 "/usr/share/bison.simple"
2155 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2156 into yyparse. The argument should have type void *.
2157 It should actually point to an object.
2158 Grammar actions can access the variable by casting it
2159 to the proper pointer type. */
2161 #ifdef YYPARSE_PARAM
2163 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2164 #define YYPARSE_PARAM_DECL
2165 #else /* not __cplusplus */
2166 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2167 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2168 #endif /* not __cplusplus */
2169 #else /* not YYPARSE_PARAM */
2170 #define YYPARSE_PARAM_ARG
2171 #define YYPARSE_PARAM_DECL
2172 #endif /* not YYPARSE_PARAM */
2174 /* Prevent warning if -Wstrict-prototypes. */
2176 #ifdef YYPARSE_PARAM
2177 int yyparse (void *);
2184 yyparse(YYPARSE_PARAM_ARG)
2187 register int yystate;
2189 register short *yyssp;
2190 register YYSTYPE *yyvsp;
2191 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2192 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2194 short yyssa[YYINITDEPTH]; /* the state stack */
2195 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2197 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2198 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2201 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2202 YYLTYPE *yyls = yylsa;
2205 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2207 #define YYPOPSTACK (yyvsp--, yyssp--)
2210 int yystacksize = YYINITDEPTH;
2211 int yyfree_stacks = 0;
2222 YYSTYPE yyval; /* the variable used to return */
2223 /* semantic values from the action */
2230 fprintf(stderr, "Starting parse\n");
2236 yychar = YYEMPTY; /* Cause a token to be read. */
2238 /* Initialize stack pointers.
2239 Waste one element of value and location stack
2240 so that they stay on the same level as the state stack.
2241 The wasted elements are never initialized. */
2249 /* Push a new state, which is found in yystate . */
2250 /* In all cases, when you get here, the value and location stacks
2251 have just been pushed. so pushing a state here evens the stacks. */
2256 if (yyssp >= yyss + yystacksize - 1)
2258 /* Give user a chance to reallocate the stack */
2259 /* Use copies of these so that the &'s don't force the real ones into memory. */
2260 YYSTYPE *yyvs1 = yyvs;
2261 short *yyss1 = yyss;
2263 YYLTYPE *yyls1 = yyls;
2266 /* Get the current used size of the three stacks, in elements. */
2267 int size = yyssp - yyss + 1;
2270 /* Each stack pointer address is followed by the size of
2271 the data in use in that stack, in bytes. */
2273 /* This used to be a conditional around just the two extra args,
2274 but that might be undefined if yyoverflow is a macro. */
2275 yyoverflow("parser stack overflow",
2276 &yyss1, size * sizeof (*yyssp),
2277 &yyvs1, size * sizeof (*yyvsp),
2278 &yyls1, size * sizeof (*yylsp),
2281 yyoverflow("parser stack overflow",
2282 &yyss1, size * sizeof (*yyssp),
2283 &yyvs1, size * sizeof (*yyvsp),
2287 yyss = yyss1; yyvs = yyvs1;
2291 #else /* no yyoverflow */
2292 /* Extend the stack our own way. */
2293 if (yystacksize >= YYMAXDEPTH)
2295 yyerror("parser stack overflow");
2307 if (yystacksize > YYMAXDEPTH)
2308 yystacksize = YYMAXDEPTH;
2309 #ifndef YYSTACK_USE_ALLOCA
2312 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2313 __yy_memcpy ((char *)yyss, (char *)yyss1,
2314 size * (unsigned int) sizeof (*yyssp));
2315 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2316 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2317 size * (unsigned int) sizeof (*yyvsp));
2319 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2320 __yy_memcpy ((char *)yyls, (char *)yyls1,
2321 size * (unsigned int) sizeof (*yylsp));
2323 #endif /* no yyoverflow */
2325 yyssp = yyss + size - 1;
2326 yyvsp = yyvs + size - 1;
2328 yylsp = yyls + size - 1;
2333 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2336 if (yyssp >= yyss + yystacksize - 1)
2342 fprintf(stderr, "Entering state %d\n", yystate);
2348 /* Do appropriate processing given the current state. */
2349 /* Read a lookahead token if we need one and don't already have one. */
2352 /* First try to decide what to do without reference to lookahead token. */
2354 yyn = yypact[yystate];
2358 /* Not known => get a lookahead token if don't already have one. */
2360 /* yychar is either YYEMPTY or YYEOF
2361 or a valid token in external form. */
2363 if (yychar == YYEMPTY)
2367 fprintf(stderr, "Reading a token: ");
2372 /* Convert token to internal form (in yychar1) for indexing tables with */
2374 if (yychar <= 0) /* This means end of input. */
2377 yychar = YYEOF; /* Don't call YYLEX any more */
2381 fprintf(stderr, "Now at end of input.\n");
2386 yychar1 = YYTRANSLATE(yychar);
2391 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2392 /* Give the individual parser a way to print the precise meaning
2393 of a token, for further debugging info. */
2395 YYPRINT (stderr, yychar, yylval);
2397 fprintf (stderr, ")\n");
2403 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2408 /* yyn is what to do for this token type in this state.
2409 Negative => reduce, -yyn is rule number.
2410 Positive => shift, yyn is new state.
2411 New state is final state => don't bother to shift,
2412 just return success.
2413 0, or most negative number => error. */
2428 /* Shift the lookahead token. */
2432 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2435 /* Discard the token being shifted unless it is eof. */
2436 if (yychar != YYEOF)
2444 /* count tokens shifted since error; after three, turn off error status. */
2445 if (yyerrstatus) yyerrstatus--;
2450 /* Do the default action for the current state. */
2453 yyn = yydefact[yystate];
2457 /* Do a reduction. yyn is the number of a rule to reduce with. */
2461 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2468 fprintf (stderr, "Reducing via rule %d (line %d), ",
2471 /* Print the symbols being reduced, and their result. */
2472 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2473 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2474 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2482 #line 1122 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2483 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2486 #line 1122 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2487 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2490 #line 1123 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2491 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2494 #line 1123 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2495 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2498 #line 1124 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2499 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2502 #line 1124 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2503 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2506 #line 1125 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2507 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2510 #line 1125 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2511 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2514 #line 1126 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2515 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2518 #line 1126 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2519 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2522 #line 1130 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2523 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2526 #line 1130 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2527 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2530 #line 1131 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2531 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2534 #line 1131 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2535 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2538 #line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2539 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2542 #line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2543 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2546 #line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2547 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2550 #line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2551 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2554 #line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2555 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2558 #line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2559 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2562 #line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2563 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2566 #line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2567 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2570 #line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2571 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2574 #line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2575 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2578 #line 1137 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2579 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2582 #line 1138 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2583 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2586 #line 1147 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2587 { yyval.StrVal = 0; ;
2590 #line 1151 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2592 yyval.StrVal = yyvsp[-1].StrVal;
2597 #line 1155 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2604 #line 1163 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2611 #line 1168 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2613 yyval.StrVal = yyvsp[-1].StrVal;
2618 #line 1174 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2619 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2622 #line 1175 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2623 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2626 #line 1176 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2627 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2630 #line 1177 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2631 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2634 #line 1178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2635 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2638 #line 1182 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2639 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2642 #line 1183 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2643 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2646 #line 1184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2647 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2650 #line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2651 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2654 #line 1189 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2655 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2658 #line 1190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2659 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2662 #line 1191 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2663 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2666 #line 1195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2667 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2670 #line 1196 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2671 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2674 #line 1197 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2675 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2678 #line 1201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2679 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2682 #line 1202 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2683 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2686 #line 1203 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2687 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2690 #line 1204 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2691 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2694 #line 1205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2695 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2698 #line 1209 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2699 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2702 #line 1210 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2703 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2706 #line 1211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2707 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2710 #line 1214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2711 { yyval.UIntVal = CallingConv::C; ;
2714 #line 1215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2715 { yyval.UIntVal = CallingConv::C; ;
2718 #line 1216 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2719 { yyval.UIntVal = CallingConv::Fast; ;
2722 #line 1217 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2723 { yyval.UIntVal = CallingConv::Cold; ;
2726 #line 1218 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2727 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2730 #line 1219 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2731 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2734 #line 1220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2736 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2737 GEN_ERROR("Calling conv too large");
2738 yyval.UIntVal = yyvsp[0].UInt64Val;
2743 #line 1227 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2744 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2747 #line 1228 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2748 { yyval.ParamAttrs = ParamAttr::SExt; ;
2751 #line 1229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2752 { yyval.ParamAttrs = ParamAttr::InReg; ;
2755 #line 1230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2756 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2759 #line 1231 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2760 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2763 #line 1234 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2764 { yyval.ParamAttrs = ParamAttr::None; ;
2767 #line 1235 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2769 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2773 #line 1240 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2774 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2777 #line 1241 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2778 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2781 #line 1245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2782 { yyval.ParamAttrs = ParamAttr::None; ;
2785 #line 1246 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2787 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2791 #line 1253 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2792 { yyval.UIntVal = 0; ;
2795 #line 1254 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2797 yyval.UIntVal = yyvsp[0].UInt64Val;
2798 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2799 GEN_ERROR("Alignment must be a power of two");
2804 #line 1260 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2805 { yyval.UIntVal = 0; ;
2808 #line 1261 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2810 yyval.UIntVal = yyvsp[0].UInt64Val;
2811 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2812 GEN_ERROR("Alignment must be a power of two");
2817 #line 1269 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2819 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2820 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2821 GEN_ERROR("Invalid character in section name");
2822 yyval.StrVal = yyvsp[0].StrVal;
2827 #line 1277 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2828 { yyval.StrVal = 0; ;
2831 #line 1278 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2832 { yyval.StrVal = yyvsp[0].StrVal; ;
2835 #line 1283 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2839 #line 1284 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2843 #line 1285 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2845 CurGV->setSection(*yyvsp[0].StrVal);
2846 delete yyvsp[0].StrVal;
2851 #line 1290 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2853 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2854 GEN_ERROR("Alignment must be a power of two");
2855 CurGV->setAlignment(yyvsp[0].UInt64Val);
2860 #line 1306 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2862 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2867 #line 1310 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2869 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2874 #line 1314 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2876 if (*yyvsp[-1].TypeVal == Type::LabelTy)
2877 GEN_ERROR("Cannot form a pointer to a basic block");
2878 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2879 delete yyvsp[-1].TypeVal;
2884 #line 1321 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2885 { // Named types are also simple types...
2886 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
2888 yyval.TypeVal = new PATypeHolder(tmp);
2892 #line 1326 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2893 { // Type UpReference
2894 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
2895 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2896 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2897 yyval.TypeVal = new PATypeHolder(OT);
2898 UR_OUT("New Upreference!\n");
2903 #line 1334 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2905 std::vector<const Type*> Params;
2906 ParamAttrsVector Attrs;
2907 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
2908 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
2912 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
2913 for (; I != E; ++I, ++index) {
2914 const Type *Ty = I->Ty->get();
2915 Params.push_back(Ty);
2916 if (Ty != Type::VoidTy)
2917 if (I->Attrs != ParamAttr::None) {
2918 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
2922 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
2923 if (isVarArg) Params.pop_back();
2925 ParamAttrsList *ActualAttrs = 0;
2927 ActualAttrs = ParamAttrsList::get(Attrs);
2928 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
2929 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
2930 delete yyvsp[-4].TypeVal; // Delete the return type handle
2931 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
2936 #line 1364 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2938 std::vector<const Type*> Params;
2939 ParamAttrsVector Attrs;
2940 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
2941 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
2944 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
2946 for ( ; I != E; ++I, ++index) {
2947 const Type* Ty = I->Ty->get();
2948 Params.push_back(Ty);
2949 if (Ty != Type::VoidTy)
2950 if (I->Attrs != ParamAttr::None) {
2951 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
2955 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
2956 if (isVarArg) Params.pop_back();
2958 ParamAttrsList *ActualAttrs = 0;
2960 ActualAttrs = ParamAttrsList::get(Attrs);
2962 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
2963 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
2964 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
2969 #line 1395 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2970 { // Sized array type?
2971 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2972 delete yyvsp[-1].TypeVal;
2977 #line 1400 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2979 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
2980 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
2981 GEN_ERROR("Unsigned result not equal to signed result");
2982 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
2983 GEN_ERROR("Element type of a VectorType must be primitive");
2984 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
2985 GEN_ERROR("Vector length should be a power of 2");
2986 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2987 delete yyvsp[-1].TypeVal;
2992 #line 1412 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2993 { // Structure type?
2994 std::vector<const Type*> Elements;
2995 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2996 E = yyvsp[-1].TypeList->end(); I != E; ++I)
2997 Elements.push_back(*I);
2999 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3000 delete yyvsp[-1].TypeList;
3005 #line 1422 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3006 { // Empty structure type?
3007 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3012 #line 1426 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3014 std::vector<const Type*> Elements;
3015 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3016 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3017 Elements.push_back(*I);
3019 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3020 delete yyvsp[-2].TypeList;
3025 #line 1436 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3026 { // Empty structure type?
3027 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3032 #line 1443 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3034 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3035 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3039 #line 1450 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3041 if (!UpRefs.empty())
3042 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3043 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3044 GEN_ERROR("LLVM functions cannot return aggregate types");
3045 yyval.TypeVal = yyvsp[0].TypeVal;
3049 #line 1457 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3051 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3055 #line 1462 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3057 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3058 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3063 #line 1467 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3065 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3070 #line 1475 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3072 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3073 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3074 TWA.Ty = new PATypeHolder(Type::VoidTy);
3075 yyval.TypeWithAttrsList->push_back(TWA);
3080 #line 1482 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3082 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3083 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3084 TWA.Ty = new PATypeHolder(Type::VoidTy);
3085 yyval.TypeWithAttrsList->push_back(TWA);
3090 #line 1489 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3092 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3097 #line 1497 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3099 yyval.TypeList = new std::list<PATypeHolder>();
3100 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3101 delete yyvsp[0].TypeVal;
3106 #line 1503 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3108 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3109 delete yyvsp[0].TypeVal;
3114 #line 1515 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3115 { // Nonempty unsized arr
3116 if (!UpRefs.empty())
3117 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3118 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3120 GEN_ERROR("Cannot make array constant with type: '" +
3121 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3122 const Type *ETy = ATy->getElementType();
3123 int NumElements = ATy->getNumElements();
3125 // Verify that we have the correct size...
3126 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3127 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3128 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3129 itostr(NumElements) + "");
3131 // Verify all elements are correct type!
3132 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3133 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3134 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3135 ETy->getDescription() +"' as required!\nIt is of type '"+
3136 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3139 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3140 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3145 #line 1543 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3147 if (!UpRefs.empty())
3148 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3149 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3151 GEN_ERROR("Cannot make array constant with type: '" +
3152 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3154 int NumElements = ATy->getNumElements();
3155 if (NumElements != -1 && NumElements != 0)
3156 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3157 " arguments, but has size of " + itostr(NumElements) +"");
3158 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3159 delete yyvsp[-2].TypeVal;
3164 #line 1559 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3166 if (!UpRefs.empty())
3167 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3168 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3170 GEN_ERROR("Cannot make array constant with type: '" +
3171 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3173 int NumElements = ATy->getNumElements();
3174 const Type *ETy = ATy->getElementType();
3175 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3176 GEN_ERROR("Can't build string constant of size " +
3177 itostr((int)(yyvsp[0].StrVal->length())) +
3178 " when array has size " + itostr(NumElements) + "");
3179 std::vector<Constant*> Vals;
3180 if (ETy == Type::Int8Ty) {
3181 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3182 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3184 delete yyvsp[0].StrVal;
3185 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3187 delete yyvsp[0].StrVal;
3188 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3189 delete yyvsp[-2].TypeVal;
3194 #line 1586 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3195 { // Nonempty unsized arr
3196 if (!UpRefs.empty())
3197 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3198 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3200 GEN_ERROR("Cannot make packed constant with type: '" +
3201 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3202 const Type *ETy = PTy->getElementType();
3203 int NumElements = PTy->getNumElements();
3205 // Verify that we have the correct size...
3206 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3207 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3208 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3209 itostr(NumElements) + "");
3211 // Verify all elements are correct type!
3212 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3213 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3214 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3215 ETy->getDescription() +"' as required!\nIt is of type '"+
3216 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3219 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3220 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3225 #line 1614 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3227 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3229 GEN_ERROR("Cannot make struct constant with type: '" +
3230 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3232 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3233 GEN_ERROR("Illegal number of initializers for structure type");
3235 // Check to ensure that constants are compatible with the type initializer!
3236 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3237 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3238 GEN_ERROR("Expected type '" +
3239 STy->getElementType(i)->getDescription() +
3240 "' for element #" + utostr(i) +
3241 " of structure initializer");
3243 // Check to ensure that Type is not packed
3244 if (STy->isPacked())
3245 GEN_ERROR("Unpacked Initializer to vector type '" +
3246 STy->getDescription() + "'");
3248 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3249 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3254 #line 1640 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3256 if (!UpRefs.empty())
3257 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3258 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3260 GEN_ERROR("Cannot make struct constant with type: '" +
3261 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3263 if (STy->getNumContainedTypes() != 0)
3264 GEN_ERROR("Illegal number of initializers for structure type");
3266 // Check to ensure that Type is not packed
3267 if (STy->isPacked())
3268 GEN_ERROR("Unpacked Initializer to vector type '" +
3269 STy->getDescription() + "'");
3271 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3272 delete yyvsp[-2].TypeVal;
3277 #line 1660 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3279 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3281 GEN_ERROR("Cannot make struct constant with type: '" +
3282 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3284 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3285 GEN_ERROR("Illegal number of initializers for structure type");
3287 // Check to ensure that constants are compatible with the type initializer!
3288 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3289 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3290 GEN_ERROR("Expected type '" +
3291 STy->getElementType(i)->getDescription() +
3292 "' for element #" + utostr(i) +
3293 " of structure initializer");
3295 // Check to ensure that Type is packed
3296 if (!STy->isPacked())
3297 GEN_ERROR("Vector initializer to non-vector type '" +
3298 STy->getDescription() + "'");
3300 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3301 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3306 #line 1686 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3308 if (!UpRefs.empty())
3309 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3310 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3312 GEN_ERROR("Cannot make struct constant with type: '" +
3313 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3315 if (STy->getNumContainedTypes() != 0)
3316 GEN_ERROR("Illegal number of initializers for structure type");
3318 // Check to ensure that Type is packed
3319 if (!STy->isPacked())
3320 GEN_ERROR("Vector initializer to non-vector type '" +
3321 STy->getDescription() + "'");
3323 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3324 delete yyvsp[-4].TypeVal;
3329 #line 1706 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3331 if (!UpRefs.empty())
3332 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3333 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3335 GEN_ERROR("Cannot make null pointer constant with type: '" +
3336 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3338 yyval.ConstVal = ConstantPointerNull::get(PTy);
3339 delete yyvsp[-1].TypeVal;
3344 #line 1718 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3346 if (!UpRefs.empty())
3347 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3348 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3349 delete yyvsp[-1].TypeVal;
3354 #line 1725 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3356 if (!UpRefs.empty())
3357 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3358 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3360 GEN_ERROR("Global const reference must be a pointer type");
3362 // ConstExprs can exist in the body of a function, thus creating
3363 // GlobalValues whenever they refer to a variable. Because we are in
3364 // the context of a function, getExistingVal will search the functions
3365 // symbol table instead of the module symbol table for the global symbol,
3366 // which throws things all off. To get around this, we just tell
3367 // getExistingVal that we are at global scope here.
3369 Function *SavedCurFn = CurFun.CurrentFunction;
3370 CurFun.CurrentFunction = 0;
3372 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3375 CurFun.CurrentFunction = SavedCurFn;
3377 // If this is an initializer for a constant pointer, which is referencing a
3378 // (currently) undefined variable, create a stub now that shall be replaced
3379 // in the future with the right type of variable.
3382 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3383 const PointerType *PT = cast<PointerType>(Ty);
3385 // First check to see if the forward references value is already created!
3386 PerModuleInfo::GlobalRefsType::iterator I =
3387 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3389 if (I != CurModule.GlobalRefs.end()) {
3390 V = I->second; // Placeholder already exists, use it...
3391 yyvsp[0].ValIDVal.destroy();
3394 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3395 Name = yyvsp[0].ValIDVal.getName();
3396 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3397 GEN_ERROR("Invalid reference to global");
3399 // Create the forward referenced global.
3401 if (const FunctionType *FTy =
3402 dyn_cast<FunctionType>(PT->getElementType())) {
3403 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3404 CurModule.CurrentModule);
3406 GV = new GlobalVariable(PT->getElementType(), false,
3407 GlobalValue::ExternalWeakLinkage, 0,
3408 Name, CurModule.CurrentModule);
3411 // Keep track of the fact that we have a forward ref to recycle it
3412 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3417 yyval.ConstVal = cast<GlobalValue>(V);
3418 delete yyvsp[-1].TypeVal; // Free the type handle
3423 #line 1791 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3425 if (!UpRefs.empty())
3426 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3427 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3428 GEN_ERROR("Mismatched types for constant expression: " +
3429 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3430 yyval.ConstVal = yyvsp[0].ConstVal;
3431 delete yyvsp[-1].TypeVal;
3436 #line 1801 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3438 if (!UpRefs.empty())
3439 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3440 const Type *Ty = yyvsp[-1].TypeVal->get();
3441 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3442 GEN_ERROR("Cannot create a null initialized value of this type");
3443 yyval.ConstVal = Constant::getNullValue(Ty);
3444 delete yyvsp[-1].TypeVal;
3449 #line 1811 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3450 { // integral constants
3451 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3452 GEN_ERROR("Constant value doesn't fit in type");
3453 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3458 #line 1817 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3459 { // arbitrary precision integer constants
3460 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3461 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3462 GEN_ERROR("Constant value does not fit in type");
3464 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3465 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3466 delete yyvsp[0].APIntVal;
3471 #line 1827 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3472 { // integral constants
3473 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3474 GEN_ERROR("Constant value doesn't fit in type");
3475 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3480 #line 1833 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3481 { // arbitrary precision integer constants
3482 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3483 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3484 GEN_ERROR("Constant value does not fit in type");
3486 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3487 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3488 delete yyvsp[0].APIntVal;
3493 #line 1843 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3494 { // Boolean constants
3495 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3496 yyval.ConstVal = ConstantInt::getTrue();
3501 #line 1848 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3502 { // Boolean constants
3503 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3504 yyval.ConstVal = ConstantInt::getFalse();
3509 #line 1853 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3510 { // Float & Double constants
3511 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
3512 GEN_ERROR("Floating point constant invalid for type");
3513 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
3518 #line 1861 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3520 if (!UpRefs.empty())
3521 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3522 Constant *Val = yyvsp[-3].ConstVal;
3523 const Type *DestTy = yyvsp[-1].TypeVal->get();
3524 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3525 GEN_ERROR("invalid cast opcode for cast from '" +
3526 Val->getType()->getDescription() + "' to '" +
3527 DestTy->getDescription() + "'");
3528 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3529 delete yyvsp[-1].TypeVal;
3533 #line 1873 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3535 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3536 GEN_ERROR("GetElementPtr requires a pointer operand");
3539 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), &(*yyvsp[-1].ValueList)[0], yyvsp[-1].ValueList->size(),
3542 GEN_ERROR("Index list invalid for constant getelementptr");
3544 SmallVector<Constant*, 8> IdxVec;
3545 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3546 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3547 IdxVec.push_back(C);
3549 GEN_ERROR("Indices to constant getelementptr must be constants");
3551 delete yyvsp[-1].ValueList;
3553 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3558 #line 1895 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3560 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3561 GEN_ERROR("Select condition must be of boolean type");
3562 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3563 GEN_ERROR("Select operand types must match");
3564 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3569 #line 1903 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3571 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3572 GEN_ERROR("Binary operator types must match");
3574 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3578 #line 1909 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3580 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3581 GEN_ERROR("Logical operator types must match");
3582 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3583 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3584 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3585 GEN_ERROR("Logical operator requires integral operands");
3587 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3592 #line 1920 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3594 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3595 GEN_ERROR("icmp operand types must match");
3596 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3600 #line 1925 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3602 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3603 GEN_ERROR("fcmp operand types must match");
3604 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3608 #line 1930 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3610 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3611 GEN_ERROR("Invalid extractelement operands");
3612 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3617 #line 1936 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3619 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3620 GEN_ERROR("Invalid insertelement operands");
3621 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3626 #line 1942 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3628 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3629 GEN_ERROR("Invalid shufflevector operands");
3630 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3635 #line 1951 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3637 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3642 #line 1955 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3644 yyval.ConstVector = new std::vector<Constant*>();
3645 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3650 #line 1963 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3651 { yyval.BoolVal = false; ;
3654 #line 1963 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3655 { yyval.BoolVal = true; ;
3658 #line 1966 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3659 { yyval.BoolVal = true; ;
3662 #line 1966 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3663 { yyval.BoolVal = false; ;
3666 #line 1969 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3668 const Type* VTy = yyvsp[-1].TypeVal->get();
3669 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3670 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3672 GEN_ERROR("Aliases can be created only to global values");
3674 yyval.ConstVal = Aliasee;
3676 delete yyvsp[-1].TypeVal;
3680 #line 1980 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3682 Constant *Val = yyvsp[-3].ConstVal;
3683 const Type *DestTy = yyvsp[-1].TypeVal->get();
3684 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3685 GEN_ERROR("invalid cast opcode for cast from '" +
3686 Val->getType()->getDescription() + "' to '" +
3687 DestTy->getDescription() + "'");
3689 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3691 delete yyvsp[-1].TypeVal;
3695 #line 2001 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3697 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3698 CurModule.ModuleDone();
3703 #line 2006 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3705 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3706 CurModule.ModuleDone();
3711 #line 2019 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3712 { CurFun.isDeclare = false; ;
3715 #line 2019 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3717 CurFun.FunctionDone();
3722 #line 2023 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3723 { CurFun.isDeclare = true; ;
3726 #line 2023 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3732 #line 2026 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3738 #line 2029 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3740 if (!UpRefs.empty())
3741 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3742 // Eagerly resolve types. This is not an optimization, this is a
3743 // requirement that is due to the fact that we could have this:
3745 // %list = type { %list * }
3746 // %list = type { %list * } ; repeated type decl
3748 // If types are not resolved eagerly, then the two types will not be
3749 // determined to be the same type!
3751 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3753 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3755 // If this is a named type that is not a redefinition, add it to the slot
3757 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3760 delete yyvsp[0].TypeVal;
3765 #line 2053 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3767 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3769 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3771 // If this is a named type that is not a redefinition, add it to the slot
3773 CurModule.Types.push_back(yyvsp[0].PrimType);
3779 #line 2064 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3781 /* "Externally Visible" Linkage */
3782 if (yyvsp[0].ConstVal == 0)
3783 GEN_ERROR("Global value initializer is not a constant");
3784 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3785 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3790 #line 2071 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3796 #line 2075 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3798 if (yyvsp[0].ConstVal == 0)
3799 GEN_ERROR("Global value initializer is not a constant");
3800 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3805 #line 2080 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3811 #line 2084 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3813 if (!UpRefs.empty())
3814 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3815 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
3817 delete yyvsp[0].TypeVal;
3821 #line 2090 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3828 #line 2094 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3831 if (yyvsp[-4].StrVal) {
3832 Name = *yyvsp[-4].StrVal;
3833 delete yyvsp[-4].StrVal;
3836 GEN_ERROR("Alias name cannot be empty");
3838 Constant* Aliasee = yyvsp[0].ConstVal;
3840 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3842 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
3843 CurModule.CurrentModule);
3844 GA->setVisibility(yyvsp[-3].Visibility);
3845 InsertValue(GA, CurModule.Values);
3850 #line 2113 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3856 #line 2116 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3862 #line 2122 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3864 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3865 if (AsmSoFar.empty())
3866 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
3868 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
3869 delete yyvsp[0].StrVal;
3874 #line 2132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3876 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
3877 delete yyvsp[0].StrVal;
3881 #line 2136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3883 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
3884 delete yyvsp[0].StrVal;
3888 #line 2143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3890 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3891 delete yyvsp[0].StrVal;
3896 #line 2148 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3898 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3899 delete yyvsp[0].StrVal;
3904 #line 2153 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3910 #line 2162 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3912 if (!UpRefs.empty())
3913 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3914 if (*yyvsp[-2].TypeVal == Type::VoidTy)
3915 GEN_ERROR("void typed arguments are invalid");
3916 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
3917 yyval.ArgList = yyvsp[-4].ArgList;
3918 yyvsp[-4].ArgList->push_back(E);
3923 #line 2172 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3925 if (!UpRefs.empty())
3926 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3927 if (*yyvsp[-2].TypeVal == Type::VoidTy)
3928 GEN_ERROR("void typed arguments are invalid");
3929 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
3930 yyval.ArgList = new ArgListType;
3931 yyval.ArgList->push_back(E);
3936 #line 2183 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3938 yyval.ArgList = yyvsp[0].ArgList;
3943 #line 2187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3945 yyval.ArgList = yyvsp[-2].ArgList;
3946 struct ArgListEntry E;
3947 E.Ty = new PATypeHolder(Type::VoidTy);
3949 E.Attrs = ParamAttr::None;
3950 yyval.ArgList->push_back(E);
3955 #line 2196 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3957 yyval.ArgList = new ArgListType;
3958 struct ArgListEntry E;
3959 E.Ty = new PATypeHolder(Type::VoidTy);
3961 E.Attrs = ParamAttr::None;
3962 yyval.ArgList->push_back(E);
3967 #line 2205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3974 #line 2211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3976 std::string FunctionName(*yyvsp[-6].StrVal);
3977 delete yyvsp[-6].StrVal; // Free strdup'd memory!
3979 // Check the function result for abstractness if this is a define. We should
3980 // have no abstract types at this point
3981 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
3982 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
3984 std::vector<const Type*> ParamTypeList;
3985 ParamAttrsVector Attrs;
3986 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
3987 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
3988 Attrs.push_back(PAWI);
3990 if (yyvsp[-4].ArgList) { // If there are arguments...
3992 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
3993 const Type* Ty = I->Ty->get();
3994 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
3995 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
3996 ParamTypeList.push_back(Ty);
3997 if (Ty != Type::VoidTy)
3998 if (I->Attrs != ParamAttr::None) {
3999 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4000 Attrs.push_back(PAWI);
4005 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4006 if (isVarArg) ParamTypeList.pop_back();
4008 ParamAttrsList *PAL = 0;
4010 PAL = ParamAttrsList::get(Attrs);
4012 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4013 const PointerType *PFT = PointerType::get(FT);
4014 delete yyvsp[-7].TypeVal;
4017 if (!FunctionName.empty()) {
4018 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4020 ID = ValID::createGlobalID(CurModule.Values.size());
4024 // See if this function was forward referenced. If so, recycle the object.
4025 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4026 // Move the function to the end of the list, from whereever it was
4027 // previously inserted.
4028 Fn = cast<Function>(FWRef);
4029 CurModule.CurrentModule->getFunctionList().remove(Fn);
4030 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4031 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4032 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4033 if (Fn->getFunctionType() != FT) {
4034 // The existing function doesn't have the same type. This is an overload
4036 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4037 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4038 // Neither the existing or the current function is a declaration and they
4039 // have the same name and same type. Clearly this is a redefinition.
4040 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4041 } if (Fn->isDeclaration()) {
4042 // Make sure to strip off any argument names so we can't get conflicts.
4043 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4047 } else { // Not already defined?
4048 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4049 CurModule.CurrentModule);
4051 InsertValue(Fn, CurModule.Values);
4054 CurFun.FunctionStart(Fn);
4056 if (CurFun.isDeclare) {
4057 // If we have declaration, always overwrite linkage. This will allow us to
4058 // correctly handle cases, when pointer to function is passed as argument to
4059 // another function.
4060 Fn->setLinkage(CurFun.Linkage);
4061 Fn->setVisibility(CurFun.Visibility);
4063 Fn->setCallingConv(yyvsp[-8].UIntVal);
4064 Fn->setAlignment(yyvsp[0].UIntVal);
4065 if (yyvsp[-1].StrVal) {
4066 Fn->setSection(*yyvsp[-1].StrVal);
4067 delete yyvsp[-1].StrVal;
4070 // Add all of the arguments we parsed to the function...
4071 if (yyvsp[-4].ArgList) { // Is null if empty...
4072 if (isVarArg) { // Nuke the last entry
4073 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4074 "Not a varargs marker!");
4075 delete yyvsp[-4].ArgList->back().Ty;
4076 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4078 Function::arg_iterator ArgIt = Fn->arg_begin();
4079 Function::arg_iterator ArgEnd = Fn->arg_end();
4081 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4082 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4083 delete I->Ty; // Delete the typeholder...
4084 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4090 delete yyvsp[-4].ArgList; // We're now done with the argument list
4096 #line 2333 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4098 yyval.FunctionVal = CurFun.CurrentFunction;
4100 // Make sure that we keep track of the linkage type even if there was a
4101 // previous "declare".
4102 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4103 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4107 #line 2344 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4109 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4114 #line 2349 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4116 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4117 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4118 yyval.FunctionVal = CurFun.CurrentFunction;
4119 CurFun.FunctionDone();
4124 #line 2361 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4126 yyval.BoolVal = false;
4131 #line 2365 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4133 yyval.BoolVal = true;
4138 #line 2370 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4139 { // A reference to a direct constant
4140 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4145 #line 2374 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4147 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4152 #line 2378 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4153 { // Perhaps it's an FP constant?
4154 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4159 #line 2382 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4161 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4166 #line 2386 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4168 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4173 #line 2390 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4175 yyval.ValIDVal = ValID::createNull();
4180 #line 2394 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4182 yyval.ValIDVal = ValID::createUndef();
4187 #line 2398 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4188 { // A vector zero constant.
4189 yyval.ValIDVal = ValID::createZeroInit();
4194 #line 2402 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4195 { // Nonempty unsized packed vector
4196 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4197 int NumElements = yyvsp[-1].ConstVector->size();
4199 VectorType* pt = VectorType::get(ETy, NumElements);
4200 PATypeHolder* PTy = new PATypeHolder(
4208 // Verify all elements are correct type!
4209 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4210 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4211 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4212 ETy->getDescription() +"' as required!\nIt is of type '" +
4213 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4216 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4217 delete PTy; delete yyvsp[-1].ConstVector;
4222 #line 2427 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4224 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4229 #line 2431 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4231 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4232 delete yyvsp[-2].StrVal;
4233 delete yyvsp[0].StrVal;
4238 #line 2441 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4239 { // Is it an integer reference...?
4240 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4245 #line 2445 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4247 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4252 #line 2449 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4253 { // Is it a named reference...?
4254 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4255 delete yyvsp[0].StrVal;
4260 #line 2454 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4261 { // Is it a named reference...?
4262 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4263 delete yyvsp[0].StrVal;
4268 #line 2467 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4270 if (!UpRefs.empty())
4271 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4272 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4273 delete yyvsp[-1].TypeVal;
4278 #line 2476 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4280 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4285 #line 2480 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4286 { // Do not allow functions with 0 basic blocks
4287 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4292 #line 2489 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4294 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4296 InsertValue(yyvsp[0].TermInstVal);
4297 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4298 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4303 #line 2498 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4305 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4306 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4307 if (CI2->getParent() == 0)
4308 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4309 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4310 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4315 #line 2507 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4316 { // Empty space between instruction lists
4317 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4322 #line 2511 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4323 { // Labelled (named) basic block
4324 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4325 delete yyvsp[0].StrVal;
4331 #line 2518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4332 { // Return with a result...
4333 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4338 #line 2522 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4339 { // Return with no result...
4340 yyval.TermInstVal = new ReturnInst();
4345 #line 2526 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4346 { // Unconditional Branch...
4347 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4349 yyval.TermInstVal = new BranchInst(tmpBB);
4353 #line 2531 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4355 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4356 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4358 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4360 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4362 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4366 #line 2541 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4368 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4370 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4372 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4373 yyval.TermInstVal = S;
4375 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4376 E = yyvsp[-1].JumpTable->end();
4377 for (; I != E; ++I) {
4378 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4379 S->addCase(CI, I->second);
4381 GEN_ERROR("Switch case is constant, but not a simple integer");
4383 delete yyvsp[-1].JumpTable;
4388 #line 2560 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4390 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4392 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4394 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4395 yyval.TermInstVal = S;
4400 #line 2570 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4403 // Handle the short syntax
4404 const PointerType *PFTy = 0;
4405 const FunctionType *Ty = 0;
4406 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4407 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4408 // Pull out the types of all of the arguments...
4409 std::vector<const Type*> ParamTypes;
4410 ParamAttrsVector Attrs;
4411 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4412 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4413 Attrs.push_back(PAWI);
4415 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
4417 for (; I != E; ++I, ++index) {
4418 const Type *Ty = I->Val->getType();
4419 if (Ty == Type::VoidTy)
4420 GEN_ERROR("Short call syntax cannot be used with varargs");
4421 ParamTypes.push_back(Ty);
4422 if (I->Attrs != ParamAttr::None) {
4423 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4424 Attrs.push_back(PAWI);
4428 ParamAttrsList *PAL = 0;
4430 PAL = ParamAttrsList::get(Attrs);
4431 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
4432 PFTy = PointerType::get(Ty);
4435 delete yyvsp[-11].TypeVal;
4437 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4439 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4441 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4444 // Check the arguments
4446 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
4447 // Make sure no arguments is a good thing!
4448 if (Ty->getNumParams() != 0)
4449 GEN_ERROR("No arguments passed to a function that "
4450 "expects arguments");
4451 } else { // Has arguments?
4452 // Loop through FunctionType's arguments and ensure they are specified
4454 FunctionType::param_iterator I = Ty->param_begin();
4455 FunctionType::param_iterator E = Ty->param_end();
4456 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
4458 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4459 if (ArgI->Val->getType() != *I)
4460 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4461 (*I)->getDescription() + "'");
4462 Args.push_back(ArgI->Val);
4465 if (Ty->isVarArg()) {
4467 for (; ArgI != ArgE; ++ArgI)
4468 Args.push_back(ArgI->Val); // push the remaining varargs
4469 } else if (I != E || ArgI != ArgE)
4470 GEN_ERROR("Invalid number of parameters detected");
4473 // Create the InvokeInst
4474 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
4475 II->setCallingConv(yyvsp[-12].UIntVal);
4476 yyval.TermInstVal = II;
4477 delete yyvsp[-8].ValueRefList;
4482 #line 2649 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4484 yyval.TermInstVal = new UnwindInst();
4489 #line 2653 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4491 yyval.TermInstVal = new UnreachableInst();
4496 #line 2660 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4498 yyval.JumpTable = yyvsp[-5].JumpTable;
4499 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4502 GEN_ERROR("May only switch on a constant pool value");
4504 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4506 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4510 #line 2671 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4512 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4513 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4517 GEN_ERROR("May only switch on a constant pool value");
4519 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4521 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4525 #line 2684 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4527 // Is this definition named?? if so, assign the name...
4528 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4530 InsertValue(yyvsp[0].InstVal);
4531 yyval.InstVal = yyvsp[0].InstVal;
4536 #line 2694 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4537 { // Used for PHI nodes
4538 if (!UpRefs.empty())
4539 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4540 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4541 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4543 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4545 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4546 delete yyvsp[-5].TypeVal;
4550 #line 2705 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4552 yyval.PHIList = yyvsp[-6].PHIList;
4553 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4555 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4557 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4561 #line 2715 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4563 if (!UpRefs.empty())
4564 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4565 // Used for call and invoke instructions
4566 yyval.ValueRefList = new ValueRefList();
4567 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4568 yyval.ValueRefList->push_back(E);
4569 delete yyvsp[-2].TypeVal;
4573 #line 2724 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4575 if (!UpRefs.empty())
4576 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4577 yyval.ValueRefList = yyvsp[-4].ValueRefList;
4578 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4579 yyval.ValueRefList->push_back(E);
4580 delete yyvsp[-2].TypeVal;
4585 #line 2733 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4586 { yyval.ValueRefList = new ValueRefList(); ;
4589 #line 2736 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4590 { yyval.ValueList = new std::vector<Value*>(); ;
4593 #line 2737 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4595 yyval.ValueList = yyvsp[-2].ValueList;
4596 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4601 #line 2744 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4603 yyval.BoolVal = true;
4608 #line 2748 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4610 yyval.BoolVal = false;
4615 #line 2753 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4617 if (!UpRefs.empty())
4618 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4619 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4620 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4622 "Arithmetic operator requires integer, FP, or packed operands");
4623 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4624 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4625 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4626 yyvsp[-4].BinaryOpVal == Instruction::FRem))
4627 GEN_ERROR("Remainder not supported on vector types");
4628 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4630 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4632 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4633 if (yyval.InstVal == 0)
4634 GEN_ERROR("binary operator returned null");
4635 delete yyvsp[-3].TypeVal;
4639 #line 2774 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4641 if (!UpRefs.empty())
4642 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4643 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4644 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4645 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4646 GEN_ERROR("Logical operator requires integral operands");
4648 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4650 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4652 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4653 if (yyval.InstVal == 0)
4654 GEN_ERROR("binary operator returned null");
4655 delete yyvsp[-3].TypeVal;
4659 #line 2791 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4661 if (!UpRefs.empty())
4662 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4663 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4664 GEN_ERROR("Vector types not supported by icmp instruction");
4665 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4667 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4669 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4670 if (yyval.InstVal == 0)
4671 GEN_ERROR("icmp operator returned null");
4672 delete yyvsp[-3].TypeVal;
4676 #line 2805 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4678 if (!UpRefs.empty())
4679 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4680 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4681 GEN_ERROR("Vector types not supported by fcmp instruction");
4682 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4684 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4686 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4687 if (yyval.InstVal == 0)
4688 GEN_ERROR("fcmp operator returned null");
4689 delete yyvsp[-3].TypeVal;
4693 #line 2819 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4695 if (!UpRefs.empty())
4696 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4697 Value* Val = yyvsp[-2].ValueVal;
4698 const Type* DestTy = yyvsp[0].TypeVal->get();
4699 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4700 GEN_ERROR("invalid cast opcode for cast from '" +
4701 Val->getType()->getDescription() + "' to '" +
4702 DestTy->getDescription() + "'");
4703 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4704 delete yyvsp[0].TypeVal;
4708 #line 2831 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4710 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4711 GEN_ERROR("select condition must be boolean");
4712 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4713 GEN_ERROR("select value types should match");
4714 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4719 #line 2839 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4721 if (!UpRefs.empty())
4722 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4723 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4724 delete yyvsp[0].TypeVal;
4729 #line 2846 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4731 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4732 GEN_ERROR("Invalid extractelement operands");
4733 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4738 #line 2852 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4740 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4741 GEN_ERROR("Invalid insertelement operands");
4742 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4747 #line 2858 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4749 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4750 GEN_ERROR("Invalid shufflevector operands");
4751 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4756 #line 2864 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4758 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4759 if (!Ty->isFirstClassType())
4760 GEN_ERROR("PHI node operands must be of first class type");
4761 yyval.InstVal = new PHINode(Ty);
4762 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4763 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4764 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4765 GEN_ERROR("All elements of a PHI node must be of the same type");
4766 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4767 yyvsp[0].PHIList->pop_front();
4769 delete yyvsp[0].PHIList; // Free the list...
4774 #line 2880 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4777 // Handle the short syntax
4778 const PointerType *PFTy = 0;
4779 const FunctionType *Ty = 0;
4780 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
4781 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4782 // Pull out the types of all of the arguments...
4783 std::vector<const Type*> ParamTypes;
4784 ParamAttrsVector Attrs;
4785 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4786 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
4787 Attrs.push_back(PAWI);
4790 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
4791 for (; I != E; ++I, ++index) {
4792 const Type *Ty = I->Val->getType();
4793 if (Ty == Type::VoidTy)
4794 GEN_ERROR("Short call syntax cannot be used with varargs");
4795 ParamTypes.push_back(Ty);
4796 if (I->Attrs != ParamAttr::None) {
4797 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4798 Attrs.push_back(PAWI);
4802 ParamAttrsList *PAL = 0;
4804 PAL = ParamAttrsList::get(Attrs);
4806 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
4807 PFTy = PointerType::get(Ty);
4810 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
4813 // Check for call to invalid intrinsic to avoid crashing later.
4814 if (Function *theF = dyn_cast<Function>(V)) {
4815 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4816 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4817 !theF->getIntrinsicID(true))
4818 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4819 theF->getName() + "'");
4822 // Check the arguments
4824 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
4825 // Make sure no arguments is a good thing!
4826 if (Ty->getNumParams() != 0)
4827 GEN_ERROR("No arguments passed to a function that "
4828 "expects arguments");
4829 } else { // Has arguments?
4830 // Loop through FunctionType's arguments and ensure they are specified
4833 FunctionType::param_iterator I = Ty->param_begin();
4834 FunctionType::param_iterator E = Ty->param_end();
4835 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
4837 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4838 if (ArgI->Val->getType() != *I)
4839 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4840 (*I)->getDescription() + "'");
4841 Args.push_back(ArgI->Val);
4843 if (Ty->isVarArg()) {
4845 for (; ArgI != ArgE; ++ArgI)
4846 Args.push_back(ArgI->Val); // push the remaining varargs
4847 } else if (I != E || ArgI != ArgE)
4848 GEN_ERROR("Invalid number of parameters detected");
4850 // Create the call node
4851 CallInst *CI = new CallInst(V, &Args[0], Args.size());
4852 CI->setTailCall(yyvsp[-7].BoolVal);
4853 CI->setCallingConv(yyvsp[-6].UIntVal);
4855 delete yyvsp[-2].ValueRefList;
4856 delete yyvsp[-5].TypeVal;
4861 #line 2964 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4863 yyval.InstVal = yyvsp[0].InstVal;
4868 #line 2969 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4870 yyval.BoolVal = true;
4875 #line 2973 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4877 yyval.BoolVal = false;
4882 #line 2980 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4884 if (!UpRefs.empty())
4885 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4886 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4887 delete yyvsp[-1].TypeVal;
4892 #line 2987 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4894 if (!UpRefs.empty())
4895 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
4896 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4898 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4899 delete yyvsp[-4].TypeVal;
4903 #line 2995 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4905 if (!UpRefs.empty())
4906 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4907 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4908 delete yyvsp[-1].TypeVal;
4913 #line 3002 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4915 if (!UpRefs.empty())
4916 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
4917 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4919 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4920 delete yyvsp[-4].TypeVal;
4924 #line 3010 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4926 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
4927 GEN_ERROR("Trying to free nonpointer type " +
4928 yyvsp[0].ValueVal->getType()->getDescription() + "");
4929 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
4934 #line 3018 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4936 if (!UpRefs.empty())
4937 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4938 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
4939 GEN_ERROR("Can't load from nonpointer type: " +
4940 (*yyvsp[-2].TypeVal)->getDescription());
4941 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
4942 GEN_ERROR("Can't load from pointer of non-first-class type: " +
4943 (*yyvsp[-2].TypeVal)->getDescription());
4944 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
4946 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
4947 delete yyvsp[-2].TypeVal;
4951 #line 3032 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4953 if (!UpRefs.empty())
4954 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4955 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
4957 GEN_ERROR("Can't store to a nonpointer type: " +
4958 (*yyvsp[-2].TypeVal)->getDescription());
4959 const Type *ElTy = PT->getElementType();
4960 if (ElTy != yyvsp[-4].ValueVal->getType())
4961 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
4962 "' into space of type '" + ElTy->getDescription() + "'");
4964 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
4966 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
4967 delete yyvsp[-2].TypeVal;
4971 #line 3049 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4973 if (!UpRefs.empty())
4974 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4975 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
4976 GEN_ERROR("getelementptr insn requires pointer operand");
4978 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size(), true))
4979 GEN_ERROR("Invalid getelementptr indices for type '" +
4980 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
4981 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
4983 yyval.InstVal = new GetElementPtrInst(tmpVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size());
4984 delete yyvsp[-2].TypeVal;
4985 delete yyvsp[0].ValueList;
4989 /* the action file gets copied in in place of this dollarsign */
4990 #line 543 "/usr/share/bison.simple"
5001 short *ssp1 = yyss - 1;
5002 fprintf (stderr, "state stack now");
5003 while (ssp1 != yyssp)
5004 fprintf (stderr, " %d", *++ssp1);
5005 fprintf (stderr, "\n");
5015 yylsp->first_line = yylloc.first_line;
5016 yylsp->first_column = yylloc.first_column;
5017 yylsp->last_line = (yylsp-1)->last_line;
5018 yylsp->last_column = (yylsp-1)->last_column;
5023 yylsp->last_line = (yylsp+yylen-1)->last_line;
5024 yylsp->last_column = (yylsp+yylen-1)->last_column;
5028 /* Now "shift" the result of the reduction.
5029 Determine what state that goes to,
5030 based on the state we popped back to
5031 and the rule number reduced by. */
5035 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5036 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5037 yystate = yytable[yystate];
5039 yystate = yydefgoto[yyn - YYNTBASE];
5043 yyerrlab: /* here on detecting error */
5046 /* If not already recovering from an error, report this error. */
5050 #ifdef YYERROR_VERBOSE
5051 yyn = yypact[yystate];
5053 if (yyn > YYFLAG && yyn < YYLAST)
5060 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5061 for (x = (yyn < 0 ? -yyn : 0);
5062 x < (sizeof(yytname) / sizeof(char *)); x++)
5063 if (yycheck[x + yyn] == x)
5064 size += strlen(yytname[x]) + 15, count++;
5065 msg = (char *) malloc(size + 15);
5068 strcpy(msg, "parse error");
5073 for (x = (yyn < 0 ? -yyn : 0);
5074 x < (sizeof(yytname) / sizeof(char *)); x++)
5075 if (yycheck[x + yyn] == x)
5077 strcat(msg, count == 0 ? ", expecting `" : " or `");
5078 strcat(msg, yytname[x]);
5087 yyerror ("parse error; also virtual memory exceeded");
5090 #endif /* YYERROR_VERBOSE */
5091 yyerror("parse error");
5095 yyerrlab1: /* here on error raised explicitly by an action */
5097 if (yyerrstatus == 3)
5099 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5101 /* return failure if at end of input */
5102 if (yychar == YYEOF)
5107 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5113 /* Else will try to reuse lookahead token
5114 after shifting the error token. */
5116 yyerrstatus = 3; /* Each real token shifted decrements this */
5120 yyerrdefault: /* current state does not do anything special for the error token. */
5123 /* This is wrong; only states that explicitly want error tokens
5124 should shift them. */
5125 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5126 if (yyn) goto yydefault;
5129 yyerrpop: /* pop the current state because it cannot handle the error token */
5131 if (yyssp == yyss) YYABORT;
5141 short *ssp1 = yyss - 1;
5142 fprintf (stderr, "Error: state stack now");
5143 while (ssp1 != yyssp)
5144 fprintf (stderr, " %d", *++ssp1);
5145 fprintf (stderr, "\n");
5151 yyn = yypact[yystate];
5156 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5175 fprintf(stderr, "Shifting error token, ");
5187 /* YYACCEPT comes here. */
5199 /* YYABORT comes here. */
5210 #line 3066 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5213 // common code from the two 'RunVMAsmParser' functions
5214 static Module* RunParser(Module * M) {
5216 llvmAsmlineno = 1; // Reset the current line number...
5217 CurModule.CurrentModule = M;
5222 // Check to make sure the parser succeeded
5225 delete ParserResult;
5229 // Emit an error if there are any unresolved types left.
5230 if (!CurModule.LateResolveTypes.empty()) {
5231 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5232 if (DID.Type == ValID::LocalName) {
5233 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5235 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5238 delete ParserResult;
5242 // Emit an error if there are any unresolved values left.
5243 if (!CurModule.LateResolveValues.empty()) {
5244 Value *V = CurModule.LateResolveValues.back();
5245 std::map<Value*, std::pair<ValID, int> >::iterator I =
5246 CurModule.PlaceHolderInfo.find(V);
5248 if (I != CurModule.PlaceHolderInfo.end()) {
5249 ValID &DID = I->second.first;
5250 if (DID.Type == ValID::LocalName) {
5251 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5253 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5256 delete ParserResult;
5261 // Check to make sure that parsing produced a result
5265 // Reset ParserResult variable while saving its value for the result.
5266 Module *Result = ParserResult;
5272 void llvm::GenerateError(const std::string &message, int LineNo) {
5273 if (LineNo == -1) LineNo = llvmAsmlineno;
5274 // TODO: column number in exception
5276 TheParseError->setError(CurFilename, message, LineNo);
5280 int yyerror(const char *ErrorMsg) {
5282 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5283 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5284 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5285 if (yychar != YYEMPTY && yychar != 0)
5286 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5288 GenerateError(errMsg);