LLVM API Documentation
00001 /* A Bison parser, made by GNU Bison 2.3. */ 00002 00003 /* Skeleton implementation for Bison's Yacc-like parsers in C 00004 00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00006 Free Software Foundation, Inc. 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2, or (at your option) 00011 any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. */ 00022 00023 /* As a special exception, you may create a larger work that contains 00024 part or all of the Bison parser skeleton and distribute that work 00025 under terms of your choice, so long as that work isn't itself a 00026 parser generator using the skeleton or a modified version thereof 00027 as a parser skeleton. Alternatively, if you modify or redistribute 00028 the parser skeleton itself, you may (at your option) remove this 00029 special exception, which will cause the skeleton and the resulting 00030 Bison output files to be licensed under the GNU General Public 00031 License without this special exception. 00032 00033 This special exception was added by the Free Software Foundation in 00034 version 2.2 of Bison. */ 00035 00036 /* C LALR(1) parser skeleton written by Richard Stallman, by 00037 simplifying the original so-called "semantic" parser. */ 00038 00039 /* All symbols defined below should begin with yy or YY, to avoid 00040 infringing on user name space. This should be done even for local 00041 variables, as they might otherwise be expanded by user macros. 00042 There are some unavoidable exceptions within include files to 00043 define necessary library symbols; they are noted "INFRINGES ON 00044 USER NAME SPACE" below. */ 00045 00046 /* Identify Bison output. */ 00047 #define YYBISON 1 00048 00049 /* Bison version. */ 00050 #define YYBISON_VERSION "2.3" 00051 00052 /* Skeleton name. */ 00053 #define YYSKELETON_NAME "yacc.c" 00054 00055 /* Pure parsers. */ 00056 #define YYPURE 0 00057 00058 /* Using locations. */ 00059 #define YYLSP_NEEDED 0 00060 00061 /* Substitute the variable and function names. */ 00062 #define yyparse llvmAsmparse 00063 #define yylex llvmAsmlex 00064 #define yyerror llvmAsmerror 00065 #define yylval llvmAsmlval 00066 #define yychar llvmAsmchar 00067 #define yydebug llvmAsmdebug 00068 #define yynerrs llvmAsmnerrs 00069 00070 00071 /* Tokens. */ 00072 #ifndef YYTOKENTYPE 00073 # define YYTOKENTYPE 00074 /* Put the tokens into the symbol table, so that GDB and other debuggers 00075 know about them. */ 00076 enum yytokentype { 00077 ESINT64VAL = 258, 00078 EUINT64VAL = 259, 00079 SINTVAL = 260, 00080 UINTVAL = 261, 00081 FPVAL = 262, 00082 VOID = 263, 00083 BOOL = 264, 00084 SBYTE = 265, 00085 UBYTE = 266, 00086 SHORT = 267, 00087 USHORT = 268, 00088 INT = 269, 00089 UINT = 270, 00090 LONG = 271, 00091 ULONG = 272, 00092 FLOAT = 273, 00093 DOUBLE = 274, 00094 TYPE = 275, 00095 LABEL = 276, 00096 VAR_ID = 277, 00097 LABELSTR = 278, 00098 STRINGCONSTANT = 279, 00099 IMPLEMENTATION = 280, 00100 ZEROINITIALIZER = 281, 00101 TRUETOK = 282, 00102 FALSETOK = 283, 00103 BEGINTOK = 284, 00104 ENDTOK = 285, 00105 DECLARE = 286, 00106 GLOBAL = 287, 00107 CONSTANT = 288, 00108 SECTION = 289, 00109 VOLATILE = 290, 00110 TO = 291, 00111 DOTDOTDOT = 292, 00112 NULL_TOK = 293, 00113 UNDEF = 294, 00114 CONST = 295, 00115 INTERNAL = 296, 00116 LINKONCE = 297, 00117 WEAK = 298, 00118 APPENDING = 299, 00119 OPAQUE = 300, 00120 NOT = 301, 00121 EXTERNAL = 302, 00122 TARGET = 303, 00123 TRIPLE = 304, 00124 ENDIAN = 305, 00125 POINTERSIZE = 306, 00126 LITTLE = 307, 00127 BIG = 308, 00128 ALIGN = 309, 00129 DEPLIBS = 310, 00130 CALL = 311, 00131 TAIL = 312, 00132 ASM_TOK = 313, 00133 MODULE = 314, 00134 SIDEEFFECT = 315, 00135 CC_TOK = 316, 00136 CCC_TOK = 317, 00137 FASTCC_TOK = 318, 00138 COLDCC_TOK = 319, 00139 RET = 320, 00140 BR = 321, 00141 SWITCH = 322, 00142 INVOKE = 323, 00143 UNWIND = 324, 00144 UNREACHABLE = 325, 00145 ADD = 326, 00146 SUB = 327, 00147 MUL = 328, 00148 DIV = 329, 00149 REM = 330, 00150 AND = 331, 00151 OR = 332, 00152 XOR = 333, 00153 SETLE = 334, 00154 SETGE = 335, 00155 SETLT = 336, 00156 SETGT = 337, 00157 SETEQ = 338, 00158 SETNE = 339, 00159 MALLOC = 340, 00160 ALLOCA = 341, 00161 FREE = 342, 00162 LOAD = 343, 00163 STORE = 344, 00164 GETELEMENTPTR = 345, 00165 PHI_TOK = 346, 00166 CAST = 347, 00167 SELECT = 348, 00168 SHL = 349, 00169 SHR = 350, 00170 VAARG = 351, 00171 EXTRACTELEMENT = 352, 00172 INSERTELEMENT = 353, 00173 SHUFFLEVECTOR = 354, 00174 VAARG_old = 355, 00175 VANEXT_old = 356 00176 }; 00177 #endif 00178 /* Tokens. */ 00179 #define ESINT64VAL 258 00180 #define EUINT64VAL 259 00181 #define SINTVAL 260 00182 #define UINTVAL 261 00183 #define FPVAL 262 00184 #define VOID 263 00185 #define BOOL 264 00186 #define SBYTE 265 00187 #define UBYTE 266 00188 #define SHORT 267 00189 #define USHORT 268 00190 #define INT 269 00191 #define UINT 270 00192 #define LONG 271 00193 #define ULONG 272 00194 #define FLOAT 273 00195 #define DOUBLE 274 00196 #define TYPE 275 00197 #define LABEL 276 00198 #define VAR_ID 277 00199 #define LABELSTR 278 00200 #define STRINGCONSTANT 279 00201 #define IMPLEMENTATION 280 00202 #define ZEROINITIALIZER 281 00203 #define TRUETOK 282 00204 #define FALSETOK 283 00205 #define BEGINTOK 284 00206 #define ENDTOK 285 00207 #define DECLARE 286 00208 #define GLOBAL 287 00209 #define CONSTANT 288 00210 #define SECTION 289 00211 #define VOLATILE 290 00212 #define TO 291 00213 #define DOTDOTDOT 292 00214 #define NULL_TOK 293 00215 #define UNDEF 294 00216 #define CONST 295 00217 #define INTERNAL 296 00218 #define LINKONCE 297 00219 #define WEAK 298 00220 #define APPENDING 299 00221 #define OPAQUE 300 00222 #define NOT 301 00223 #define EXTERNAL 302 00224 #define TARGET 303 00225 #define TRIPLE 304 00226 #define ENDIAN 305 00227 #define POINTERSIZE 306 00228 #define LITTLE 307 00229 #define BIG 308 00230 #define ALIGN 309 00231 #define DEPLIBS 310 00232 #define CALL 311 00233 #define TAIL 312 00234 #define ASM_TOK 313 00235 #define MODULE 314 00236 #define SIDEEFFECT 315 00237 #define CC_TOK 316 00238 #define CCC_TOK 317 00239 #define FASTCC_TOK 318 00240 #define COLDCC_TOK 319 00241 #define RET 320 00242 #define BR 321 00243 #define SWITCH 322 00244 #define INVOKE 323 00245 #define UNWIND 324 00246 #define UNREACHABLE 325 00247 #define ADD 326 00248 #define SUB 327 00249 #define MUL 328 00250 #define DIV 329 00251 #define REM 330 00252 #define AND 331 00253 #define OR 332 00254 #define XOR 333 00255 #define SETLE 334 00256 #define SETGE 335 00257 #define SETLT 336 00258 #define SETGT 337 00259 #define SETEQ 338 00260 #define SETNE 339 00261 #define MALLOC 340 00262 #define ALLOCA 341 00263 #define FREE 342 00264 #define LOAD 343 00265 #define STORE 344 00266 #define GETELEMENTPTR 345 00267 #define PHI_TOK 346 00268 #define CAST 347 00269 #define SELECT 348 00270 #define SHL 349 00271 #define SHR 350 00272 #define VAARG 351 00273 #define EXTRACTELEMENT 352 00274 #define INSERTELEMENT 353 00275 #define SHUFFLEVECTOR 354 00276 #define VAARG_old 355 00277 #define VANEXT_old 356 00278 00279 00280 00281 00282 /* Copy the first part of user declarations. */ 00283 #line 14 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 00284 00285 #include "ParserInternals.h" 00286 #include "llvm/CallingConv.h" 00287 #include "llvm/InlineAsm.h" 00288 #include "llvm/Instructions.h" 00289 #include "llvm/Module.h" 00290 #include "llvm/SymbolTable.h" 00291 #include "llvm/Assembly/AutoUpgrade.h" 00292 #include "llvm/Support/GetElementPtrTypeIterator.h" 00293 #include "llvm/ADT/STLExtras.h" 00294 #include "llvm/Support/MathExtras.h" 00295 #include <algorithm> 00296 #include <iostream> 00297 #include <list> 00298 #include <utility> 00299 00300 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit 00301 int yylex(); // declaration" of xxx warnings. 00302 int yyparse(); 00303 00304 namespace llvm { 00305 std::string CurFilename; 00306 } 00307 using namespace llvm; 00308 00309 static Module *ParserResult; 00310 00311 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output 00312 // relating to upreferences in the input stream. 00313 // 00314 //#define DEBUG_UPREFS 1 00315 #ifdef DEBUG_UPREFS 00316 #define UR_OUT(X) std::cerr << X 00317 #else 00318 #define UR_OUT(X) 00319 #endif 00320 00321 #define YYERROR_VERBOSE 1 00322 00323 static bool ObsoleteVarArgs; 00324 static bool NewVarArgs; 00325 static BasicBlock *CurBB; 00326 static GlobalVariable *CurGV; 00327 00328 00329 // This contains info used when building the body of a function. It is 00330 // destroyed when the function is completed. 00331 // 00332 typedef std::vector<Value *> ValueList; // Numbered defs 00333 static void 00334 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, 00335 std::map<const Type *,ValueList> *FutureLateResolvers = 0); 00336 00337 static struct PerModuleInfo { 00338 Module *CurrentModule; 00339 std::map<const Type *, ValueList> Values; // Module level numbered definitions 00340 std::map<const Type *,ValueList> LateResolveValues; 00341 std::vector<PATypeHolder> Types; 00342 std::map<ValID, PATypeHolder> LateResolveTypes; 00343 00344 /// PlaceHolderInfo - When temporary placeholder objects are created, remember 00345 /// how they were referenced and one which line of the input they came from so 00346 /// that we can resolve them later and print error messages as appropriate. 00347 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; 00348 00349 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward 00350 // references to global values. Global values may be referenced before they 00351 // are defined, and if so, the temporary object that they represent is held 00352 // here. This is used for forward references of GlobalValues. 00353 // 00354 typedef std::map<std::pair<const PointerType *, 00355 ValID>, GlobalValue*> GlobalRefsType; 00356 GlobalRefsType GlobalRefs; 00357 00358 void ModuleDone() { 00359 // If we could not resolve some functions at function compilation time 00360 // (calls to functions before they are defined), resolve them now... Types 00361 // are resolved when the constant pool has been completely parsed. 00362 // 00363 ResolveDefinitions(LateResolveValues); 00364 00365 // Check to make sure that all global value forward references have been 00366 // resolved! 00367 // 00368 if (!GlobalRefs.empty()) { 00369 std::string UndefinedReferences = "Unresolved global references exist:\n"; 00370 00371 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); 00372 I != E; ++I) { 00373 UndefinedReferences += " " + I->first.first->getDescription() + " " + 00374 I->first.second.getName() + "\n"; 00375 } 00376 ThrowException(UndefinedReferences); 00377 } 00378 00379 // Look for intrinsic functions and CallInst that need to be upgraded 00380 for (Module::iterator FI = CurrentModule->begin(), 00381 FE = CurrentModule->end(); FI != FE; ) 00382 UpgradeCallsToIntrinsic(FI++); 00383 00384 Values.clear(); // Clear out function local definitions 00385 Types.clear(); 00386 CurrentModule = 0; 00387 } 00388 00389 // GetForwardRefForGlobal - Check to see if there is a forward reference 00390 // for this global. If so, remove it from the GlobalRefs map and return it. 00391 // If not, just return null. 00392 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { 00393 // Check to see if there is a forward reference to this global variable... 00394 // if there is, eliminate it and patch the reference to use the new def'n. 00395 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); 00396 GlobalValue *Ret = 0; 00397 if (I != GlobalRefs.end()) { 00398 Ret = I->second; 00399 GlobalRefs.erase(I); 00400 } 00401 return Ret; 00402 } 00403 } CurModule; 00404 00405 static struct PerFunctionInfo { 00406 Function *CurrentFunction; // Pointer to current function being created 00407 00408 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions 00409 std::map<const Type*, ValueList> LateResolveValues; 00410 bool isDeclare; // Is this function a forward declararation? 00411 00412 /// BBForwardRefs - When we see forward references to basic blocks, keep 00413 /// track of them here. 00414 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; 00415 std::vector<BasicBlock*> NumberedBlocks; 00416 unsigned NextBBNum; 00417 00418 inline PerFunctionInfo() { 00419 CurrentFunction = 0; 00420 isDeclare = false; 00421 } 00422 00423 inline void FunctionStart(Function *M) { 00424 CurrentFunction = M; 00425 NextBBNum = 0; 00426 } 00427 00428 void FunctionDone() { 00429 NumberedBlocks.clear(); 00430 00431 // Any forward referenced blocks left? 00432 if (!BBForwardRefs.empty()) 00433 ThrowException("Undefined reference to label " + 00434 BBForwardRefs.begin()->first->getName()); 00435 00436 // Resolve all forward references now. 00437 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); 00438 00439 Values.clear(); // Clear out function local definitions 00440 CurrentFunction = 0; 00441 isDeclare = false; 00442 } 00443 } CurFun; // Info for the current function... 00444 00445 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } 00446 00447 00448 //===----------------------------------------------------------------------===// 00449 // Code to handle definitions of all the types 00450 //===----------------------------------------------------------------------===// 00451 00452 static int InsertValue(Value *V, 00453 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { 00454 if (V->hasName()) return -1; // Is this a numbered definition? 00455 00456 // Yes, insert the value into the value table... 00457 ValueList &List = ValueTab[V->getType()]; 00458 List.push_back(V); 00459 return List.size()-1; 00460 } 00461 00462 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { 00463 switch (D.Type) { 00464 case ValID::NumberVal: // Is it a numbered definition? 00465 // Module constants occupy the lowest numbered slots... 00466 if ((unsigned)D.Num < CurModule.Types.size()) 00467 return CurModule.Types[(unsigned)D.Num]; 00468 break; 00469 case ValID::NameVal: // Is it a named definition? 00470 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { 00471 D.destroy(); // Free old strdup'd memory... 00472 return N; 00473 } 00474 break; 00475 default: 00476 ThrowException("Internal parser error: Invalid symbol type reference!"); 00477 } 00478 00479 // If we reached here, we referenced either a symbol that we don't know about 00480 // or an id number that hasn't been read yet. We may be referencing something 00481 // forward, so just create an entry to be resolved later and get to it... 00482 // 00483 if (DoNotImprovise) return 0; // Do we just want a null to be returned? 00484 00485 00486 if (inFunctionScope()) { 00487 if (D.Type == ValID::NameVal) 00488 ThrowException("Reference to an undefined type: '" + D.getName() + "'"); 00489 else 00490 ThrowException("Reference to an undefined type: #" + itostr(D.Num)); 00491 } 00492 00493 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); 00494 if (I != CurModule.LateResolveTypes.end()) 00495 return I->second; 00496 00497 Type *Typ = OpaqueType::get(); 00498 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); 00499 return Typ; 00500 } 00501 00502 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { 00503 SymbolTable &SymTab = 00504 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : 00505 CurModule.CurrentModule->getSymbolTable(); 00506 return SymTab.lookup(Ty, Name); 00507 } 00508 00509 // getValNonImprovising - Look up the value specified by the provided type and 00510 // the provided ValID. If the value exists and has already been defined, return 00511 // it. Otherwise return null. 00512 // 00513 static Value *getValNonImprovising(const Type *Ty, const ValID &D) { 00514 if (isa<FunctionType>(Ty)) 00515 ThrowException("Functions are not values and " 00516 "must be referenced as pointers"); 00517 00518 switch (D.Type) { 00519 case ValID::NumberVal: { // Is it a numbered definition? 00520 unsigned Num = (unsigned)D.Num; 00521 00522 // Module constants occupy the lowest numbered slots... 00523 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); 00524 if (VI != CurModule.Values.end()) { 00525 if (Num < VI->second.size()) 00526 return VI->second[Num]; 00527 Num -= VI->second.size(); 00528 } 00529 00530 // Make sure that our type is within bounds 00531 VI = CurFun.Values.find(Ty); 00532 if (VI == CurFun.Values.end()) return 0; 00533 00534 // Check that the number is within bounds... 00535 if (VI->second.size() <= Num) return 0; 00536 00537 return VI->second[Num]; 00538 } 00539 00540 case ValID::NameVal: { // Is it a named definition? 00541 Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); 00542 if (N == 0) return 0; 00543 00544 D.destroy(); // Free old strdup'd memory... 00545 return N; 00546 } 00547 00548 // Check to make sure that "Ty" is an integral type, and that our 00549 // value will fit into the specified type... 00550 case ValID::ConstSIntVal: // Is it a constant pool reference?? 00551 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) 00552 ThrowException("Signed integral constant '" + 00553 itostr(D.ConstPool64) + "' is invalid for type '" + 00554 Ty->getDescription() + "'!"); 00555 return ConstantSInt::get(Ty, D.ConstPool64); 00556 00557 case ValID::ConstUIntVal: // Is it an unsigned const pool reference? 00558 if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) { 00559 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { 00560 ThrowException("Integral constant '" + utostr(D.UConstPool64) + 00561 "' is invalid or out of range!"); 00562 } else { // This is really a signed reference. Transmogrify. 00563 return ConstantSInt::get(Ty, D.ConstPool64); 00564 } 00565 } else { 00566 return ConstantUInt::get(Ty, D.UConstPool64); 00567 } 00568 00569 case ValID::ConstFPVal: // Is it a floating point const pool reference? 00570 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) 00571 ThrowException("FP constant invalid for type!!"); 00572 return ConstantFP::get(Ty, D.ConstPoolFP); 00573 00574 case ValID::ConstNullVal: // Is it a null value? 00575 if (!isa<PointerType>(Ty)) 00576 ThrowException("Cannot create a a non pointer null!"); 00577 return ConstantPointerNull::get(cast<PointerType>(Ty)); 00578 00579 case ValID::ConstUndefVal: // Is it an undef value? 00580 return UndefValue::get(Ty); 00581 00582 case ValID::ConstZeroVal: // Is it a zero value? 00583 return Constant::getNullValue(Ty); 00584 00585 case ValID::ConstantVal: // Fully resolved constant? 00586 if (D.ConstantValue->getType() != Ty) 00587 ThrowException("Constant expression type different from required type!"); 00588 return D.ConstantValue; 00589 00590 case ValID::InlineAsmVal: { // Inline asm expression 00591 const PointerType *PTy = dyn_cast<PointerType>(Ty); 00592 const FunctionType *FTy = 00593 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; 00594 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) 00595 ThrowException("Invalid type for asm constraint string!"); 00596 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, 00597 D.IAD->HasSideEffects); 00598 D.destroy(); // Free InlineAsmDescriptor. 00599 return IA; 00600 } 00601 default: 00602 assert(0 && "Unhandled case!"); 00603 return 0; 00604 } // End of switch 00605 00606 assert(0 && "Unhandled case!"); 00607 return 0; 00608 } 00609 00610 // getVal - This function is identical to getValNonImprovising, except that if a 00611 // value is not already defined, it "improvises" by creating a placeholder var 00612 // that looks and acts just like the requested variable. When the value is 00613 // defined later, all uses of the placeholder variable are replaced with the 00614 // real thing. 00615 // 00616 static Value *getVal(const Type *Ty, const ValID &ID) { 00617 if (Ty == Type::LabelTy) 00618 ThrowException("Cannot use a basic block here"); 00619 00620 // See if the value has already been defined. 00621 Value *V = getValNonImprovising(Ty, ID); 00622 if (V) return V; 00623 00624 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) 00625 ThrowException("Invalid use of a composite type!"); 00626 00627 // If we reached here, we referenced either a symbol that we don't know about 00628 // or an id number that hasn't been read yet. We may be referencing something 00629 // forward, so just create an entry to be resolved later and get to it... 00630 // 00631 V = new Argument(Ty); 00632 00633 // Remember where this forward reference came from. FIXME, shouldn't we try 00634 // to recycle these things?? 00635 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, 00636 llvmAsmlineno))); 00637 00638 if (inFunctionScope()) 00639 InsertValue(V, CurFun.LateResolveValues); 00640 else 00641 InsertValue(V, CurModule.LateResolveValues); 00642 return V; 00643 } 00644 00645 /// getBBVal - This is used for two purposes: 00646 /// * If isDefinition is true, a new basic block with the specified ID is being 00647 /// defined. 00648 /// * If isDefinition is true, this is a reference to a basic block, which may 00649 /// or may not be a forward reference. 00650 /// 00651 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { 00652 assert(inFunctionScope() && "Can't get basic block at global scope!"); 00653 00654 std::string Name; 00655 BasicBlock *BB = 0; 00656 switch (ID.Type) { 00657 default: ThrowException("Illegal label reference " + ID.getName()); 00658 case ValID::NumberVal: // Is it a numbered definition? 00659 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) 00660 CurFun.NumberedBlocks.resize(ID.Num+1); 00661 BB = CurFun.NumberedBlocks[ID.Num]; 00662 break; 00663 case ValID::NameVal: // Is it a named definition? 00664 Name = ID.Name; 00665 if (Value *N = CurFun.CurrentFunction-> 00666 getSymbolTable().lookup(Type::LabelTy, Name)) 00667 BB = cast<BasicBlock>(N); 00668 break; 00669 } 00670 00671 // See if the block has already been defined. 00672 if (BB) { 00673 // If this is the definition of the block, make sure the existing value was 00674 // just a forward reference. If it was a forward reference, there will be 00675 // an entry for it in the PlaceHolderInfo map. 00676 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) 00677 // The existing value was a definition, not a forward reference. 00678 ThrowException("Redefinition of label " + ID.getName()); 00679 00680 ID.destroy(); // Free strdup'd memory. 00681 return BB; 00682 } 00683 00684 // Otherwise this block has not been seen before. 00685 BB = new BasicBlock("", CurFun.CurrentFunction); 00686 if (ID.Type == ValID::NameVal) { 00687 BB->setName(ID.Name); 00688 } else { 00689 CurFun.NumberedBlocks[ID.Num] = BB; 00690 } 00691 00692 // If this is not a definition, keep track of it so we can use it as a forward 00693 // reference. 00694 if (!isDefinition) { 00695 // Remember where this forward reference came from. 00696 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); 00697 } else { 00698 // The forward declaration could have been inserted anywhere in the 00699 // function: insert it into the correct place now. 00700 CurFun.CurrentFunction->getBasicBlockList().remove(BB); 00701 CurFun.CurrentFunction->getBasicBlockList().push_back(BB); 00702 } 00703 ID.destroy(); 00704 return BB; 00705 } 00706 00707 00708 //===----------------------------------------------------------------------===// 00709 // Code to handle forward references in instructions 00710 //===----------------------------------------------------------------------===// 00711 // 00712 // This code handles the late binding needed with statements that reference 00713 // values not defined yet... for example, a forward branch, or the PHI node for 00714 // a loop body. 00715 // 00716 // This keeps a table (CurFun.LateResolveValues) of all such forward references 00717 // and back patchs after we are done. 00718 // 00719 00720 // ResolveDefinitions - If we could not resolve some defs at parsing 00721 // time (forward branches, phi functions for loops, etc...) resolve the 00722 // defs now... 00723 // 00724 static void 00725 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, 00726 std::map<const Type*,ValueList> *FutureLateResolvers) { 00727 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved 00728 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), 00729 E = LateResolvers.end(); LRI != E; ++LRI) { 00730 ValueList &List = LRI->second; 00731 while (!List.empty()) { 00732 Value *V = List.back(); 00733 List.pop_back(); 00734 00735 std::map<Value*, std::pair<ValID, int> >::iterator PHI = 00736 CurModule.PlaceHolderInfo.find(V); 00737 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); 00738 00739 ValID &DID = PHI->second.first; 00740 00741 Value *TheRealValue = getValNonImprovising(LRI->first, DID); 00742 if (TheRealValue) { 00743 V->replaceAllUsesWith(TheRealValue); 00744 delete V; 00745 CurModule.PlaceHolderInfo.erase(PHI); 00746 } else if (FutureLateResolvers) { 00747 // Functions have their unresolved items forwarded to the module late 00748 // resolver table 00749 InsertValue(V, *FutureLateResolvers); 00750 } else { 00751 if (DID.Type == ValID::NameVal) 00752 ThrowException("Reference to an invalid definition: '" +DID.getName()+ 00753 "' of type '" + V->getType()->getDescription() + "'", 00754 PHI->second.second); 00755 else 00756 ThrowException("Reference to an invalid definition: #" + 00757 itostr(DID.Num) + " of type '" + 00758 V->getType()->getDescription() + "'", 00759 PHI->second.second); 00760 } 00761 } 00762 } 00763 00764 LateResolvers.clear(); 00765 } 00766 00767 // ResolveTypeTo - A brand new type was just declared. This means that (if 00768 // name is not null) things referencing Name can be resolved. Otherwise, things 00769 // refering to the number can be resolved. Do this now. 00770 // 00771 static void ResolveTypeTo(char *Name, const Type *ToTy) { 00772 ValID D; 00773 if (Name) D = ValID::create(Name); 00774 else D = ValID::create((int)CurModule.Types.size()); 00775 00776 std::map<ValID, PATypeHolder>::iterator I = 00777 CurModule.LateResolveTypes.find(D); 00778 if (I != CurModule.LateResolveTypes.end()) { 00779 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); 00780 CurModule.LateResolveTypes.erase(I); 00781 } 00782 } 00783 00784 // setValueName - Set the specified value to the name given. The name may be 00785 // null potentially, in which case this is a noop. The string passed in is 00786 // assumed to be a malloc'd string buffer, and is free'd by this function. 00787 // 00788 static void setValueName(Value *V, char *NameStr) { 00789 if (NameStr) { 00790 std::string Name(NameStr); // Copy string 00791 free(NameStr); // Free old string 00792 00793 if (V->getType() == Type::VoidTy) 00794 ThrowException("Can't assign name '" + Name+"' to value with void type!"); 00795 00796 assert(inFunctionScope() && "Must be in function scope!"); 00797 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); 00798 if (ST.lookup(V->getType(), Name)) 00799 ThrowException("Redefinition of value named '" + Name + "' in the '" + 00800 V->getType()->getDescription() + "' type plane!"); 00801 00802 // Set the name. 00803 V->setName(Name); 00804 } 00805 } 00806 00807 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, 00808 /// this is a declaration, otherwise it is a definition. 00809 static GlobalVariable * 00810 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, 00811 bool isConstantGlobal, const Type *Ty, 00812 Constant *Initializer) { 00813 if (isa<FunctionType>(Ty)) 00814 ThrowException("Cannot declare global vars of function type!"); 00815 00816 const PointerType *PTy = PointerType::get(Ty); 00817 00818 std::string Name; 00819 if (NameStr) { 00820 Name = NameStr; // Copy string 00821 free(NameStr); // Free old string 00822 } 00823 00824 // See if this global value was forward referenced. If so, recycle the 00825 // object. 00826 ValID ID; 00827 if (!Name.empty()) { 00828 ID = ValID::create((char*)Name.c_str()); 00829 } else { 00830 ID = ValID::create((int)CurModule.Values[PTy].size()); 00831 } 00832 00833 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { 00834 // Move the global to the end of the list, from whereever it was 00835 // previously inserted. 00836 GlobalVariable *GV = cast<GlobalVariable>(FWGV); 00837 CurModule.CurrentModule->getGlobalList().remove(GV); 00838 CurModule.CurrentModule->getGlobalList().push_back(GV); 00839 GV->setInitializer(Initializer); 00840 GV->setLinkage(Linkage); 00841 GV->setConstant(isConstantGlobal); 00842 InsertValue(GV, CurModule.Values); 00843 return GV; 00844 } 00845 00846 // If this global has a name, check to see if there is already a definition 00847 // of this global in the module. If so, merge as appropriate. Note that 00848 // this is really just a hack around problems in the CFE. :( 00849 if (!Name.empty()) { 00850 // We are a simple redefinition of a value, check to see if it is defined 00851 // the same as the old one. 00852 if (GlobalVariable *EGV = 00853 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { 00854 // We are allowed to redefine a global variable in two circumstances: 00855 // 1. If at least one of the globals is uninitialized or 00856 // 2. If both initializers have the same value. 00857 // 00858 if (!EGV->hasInitializer() || !Initializer || 00859 EGV->getInitializer() == Initializer) { 00860 00861 // Make sure the existing global version gets the initializer! Make 00862 // sure that it also gets marked const if the new version is. 00863 if (Initializer && !EGV->hasInitializer()) 00864 EGV->setInitializer(Initializer); 00865 if (isConstantGlobal) 00866 EGV->setConstant(true); 00867 EGV->setLinkage(Linkage); 00868 return EGV; 00869 } 00870 00871 ThrowException("Redefinition of global variable named '" + Name + 00872 "' in the '" + Ty->getDescription() + "' type plane!"); 00873 } 00874 } 00875 00876 // Otherwise there is no existing GV to use, create one now. 00877 GlobalVariable *GV = 00878 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, 00879 CurModule.CurrentModule); 00880 InsertValue(GV, CurModule.Values); 00881 return GV; 00882 } 00883 00884 // setTypeName - Set the specified type to the name given. The name may be 00885 // null potentially, in which case this is a noop. The string passed in is 00886 // assumed to be a malloc'd string buffer, and is freed by this function. 00887 // 00888 // This function returns true if the type has already been defined, but is 00889 // allowed to be redefined in the specified context. If the name is a new name 00890 // for the type plane, it is inserted and false is returned. 00891 static bool setTypeName(const Type *T, char *NameStr) { 00892 assert(!inFunctionScope() && "Can't give types function-local names!"); 00893 if (NameStr == 0) return false; 00894 00895 std::string Name(NameStr); // Copy string 00896 free(NameStr); // Free old string 00897 00898 // We don't allow assigning names to void type 00899 if (T == Type::VoidTy) 00900 ThrowException("Can't assign name '" + Name + "' to the void type!"); 00901 00902 // Set the type name, checking for conflicts as we do so. 00903 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); 00904 00905 if (AlreadyExists) { // Inserting a name that is already defined??? 00906 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); 00907 assert(Existing && "Conflict but no matching type?"); 00908 00909 // There is only one case where this is allowed: when we are refining an 00910 // opaque type. In this case, Existing will be an opaque type. 00911 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { 00912 // We ARE replacing an opaque type! 00913 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); 00914 return true; 00915 } 00916 00917 // Otherwise, this is an attempt to redefine a type. That's okay if 00918 // the redefinition is identical to the original. This will be so if 00919 // Existing and T point to the same Type object. In this one case we 00920 // allow the equivalent redefinition. 00921 if (Existing == T) return true; // Yes, it's equal. 00922 00923 // Any other kind of (non-equivalent) redefinition is an error. 00924 ThrowException("Redefinition of type named '" + Name + "' in the '" + 00925 T->getDescription() + "' type plane!"); 00926 } 00927 00928 return false; 00929 } 00930 00931 //===----------------------------------------------------------------------===// 00932 // Code for handling upreferences in type names... 00933 // 00934 00935 // TypeContains - Returns true if Ty directly contains E in it. 00936 // 00937 static bool TypeContains(const Type *Ty, const Type *E) { 00938 return std::find(Ty->subtype_begin(), Ty->subtype_end(), 00939 E) != Ty->subtype_end(); 00940 } 00941 00942 namespace { 00943 struct UpRefRecord { 00944 // NestingLevel - The number of nesting levels that need to be popped before 00945 // this type is resolved. 00946 unsigned NestingLevel; 00947 00948 // LastContainedTy - This is the type at the current binding level for the 00949 // type. Every time we reduce the nesting level, this gets updated. 00950 const Type *LastContainedTy; 00951 00952 // UpRefTy - This is the actual opaque type that the upreference is 00953 // represented with. 00954 OpaqueType *UpRefTy; 00955 00956 UpRefRecord(unsigned NL, OpaqueType *URTy) 00957 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} 00958 }; 00959 } 00960 00961 // UpRefs - A list of the outstanding upreferences that need to be resolved. 00962 static std::vector<UpRefRecord> UpRefs; 00963 00964 /// HandleUpRefs - Every time we finish a new layer of types, this function is 00965 /// called. It loops through the UpRefs vector, which is a list of the 00966 /// currently active types. For each type, if the up reference is contained in 00967 /// the newly completed type, we decrement the level count. When the level 00968 /// count reaches zero, the upreferenced type is the type that is passed in: 00969 /// thus we can complete the cycle. 00970 /// 00971 static PATypeHolder HandleUpRefs(const Type *ty) { 00972 if (!ty->isAbstract()) return ty; 00973 PATypeHolder Ty(ty); 00974 UR_OUT("Type '" << Ty->getDescription() << 00975 "' newly formed. Resolving upreferences.\n" << 00976 UpRefs.size() << " upreferences active!\n"); 00977 00978 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes 00979 // to zero), we resolve them all together before we resolve them to Ty. At 00980 // the end of the loop, if there is anything to resolve to Ty, it will be in 00981 // this variable. 00982 OpaqueType *TypeToResolve = 0; 00983 00984 for (unsigned i = 0; i != UpRefs.size(); ++i) { 00985 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " 00986 << UpRefs[i].second->getDescription() << ") = " 00987 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); 00988 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { 00989 // Decrement level of upreference 00990 unsigned Level = --UpRefs[i].NestingLevel; 00991 UpRefs[i].LastContainedTy = Ty; 00992 UR_OUT(" Uplevel Ref Level = " << Level << "\n"); 00993 if (Level == 0) { // Upreference should be resolved! 00994 if (!TypeToResolve) { 00995 TypeToResolve = UpRefs[i].UpRefTy; 00996 } else { 00997 UR_OUT(" * Resolving upreference for " 00998 << UpRefs[i].second->getDescription() << "\n"; 00999 std::string OldName = UpRefs[i].UpRefTy->getDescription()); 01000 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); 01001 UR_OUT(" * Type '" << OldName << "' refined upreference to: " 01002 << (const void*)Ty << ", " << Ty->getDescription() << "\n"); 01003 } 01004 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... 01005 --i; // Do not skip the next element... 01006 } 01007 } 01008 } 01009 01010 if (TypeToResolve) { 01011 UR_OUT(" * Resolving upreference for " 01012 << UpRefs[i].second->getDescription() << "\n"; 01013 std::string OldName = TypeToResolve->getDescription()); 01014 TypeToResolve->refineAbstractTypeTo(Ty); 01015 } 01016 01017 return Ty; 01018 } 01019 01020 01021 // common code from the two 'RunVMAsmParser' functions 01022 static Module * RunParser(Module * M) { 01023 01024 llvmAsmlineno = 1; // Reset the current line number... 01025 ObsoleteVarArgs = false; 01026 NewVarArgs = false; 01027 01028 CurModule.CurrentModule = M; 01029 yyparse(); // Parse the file, potentially throwing exception 01030 01031 Module *Result = ParserResult; 01032 ParserResult = 0; 01033 01034 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs 01035 { 01036 Function* F; 01037 if ((F = Result->getNamedFunction("llvm.va_start")) 01038 && F->getFunctionType()->getNumParams() == 0) 01039 ObsoleteVarArgs = true; 01040 if((F = Result->getNamedFunction("llvm.va_copy")) 01041 && F->getFunctionType()->getNumParams() == 1) 01042 ObsoleteVarArgs = true; 01043 } 01044 01045 if (ObsoleteVarArgs && NewVarArgs) 01046 ThrowException("This file is corrupt: it uses both new and old style varargs"); 01047 01048 if(ObsoleteVarArgs) { 01049 if(Function* F = Result->getNamedFunction("llvm.va_start")) { 01050 if (F->arg_size() != 0) 01051 ThrowException("Obsolete va_start takes 0 argument!"); 01052 01053 //foo = va_start() 01054 // -> 01055 //bar = alloca typeof(foo) 01056 //va_start(bar) 01057 //foo = load bar 01058 01059 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); 01060 const Type* ArgTy = F->getFunctionType()->getReturnType(); 01061 const Type* ArgTyPtr = PointerType::get(ArgTy); 01062 Function* NF = Result->getOrInsertFunction("llvm.va_start", 01063 RetTy, ArgTyPtr, (Type *)0); 01064 01065 while (!F->use_empty()) { 01066 CallInst* CI = cast<CallInst>(F->use_back()); 01067 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); 01068 new CallInst(NF, bar, "", CI); 01069 Value* foo = new LoadInst(bar, "vastart.fix.2", CI); 01070 CI->replaceAllUsesWith(foo); 01071 CI->getParent()->getInstList().erase(CI); 01072 } 01073 Result->getFunctionList().erase(F); 01074 } 01075 01076 if(Function* F = Result->getNamedFunction("llvm.va_end")) { 01077 if(F->arg_size() != 1) 01078 ThrowException("Obsolete va_end takes 1 argument!"); 01079 01080 //vaend foo 01081 // -> 01082 //bar = alloca 1 of typeof(foo) 01083 //vaend bar 01084 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); 01085 const Type* ArgTy = F->getFunctionType()->getParamType(0); 01086 const Type* ArgTyPtr = PointerType::get(ArgTy); 01087 Function* NF = Result->getOrInsertFunction("llvm.va_end", 01088 RetTy, ArgTyPtr, (Type *)0); 01089 01090 while (!F->use_empty()) { 01091 CallInst* CI = cast<CallInst>(F->use_back()); 01092 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); 01093 new StoreInst(CI->getOperand(1), bar, CI); 01094 new CallInst(NF, bar, "", CI); 01095 CI->getParent()->getInstList().erase(CI); 01096 } 01097 Result->getFunctionList().erase(F); 01098 } 01099 01100 if(Function* F = Result->getNamedFunction("llvm.va_copy")) { 01101 if(F->arg_size() != 1) 01102 ThrowException("Obsolete va_copy takes 1 argument!"); 01103 //foo = vacopy(bar) 01104 // -> 01105 //a = alloca 1 of typeof(foo) 01106 //b = alloca 1 of typeof(foo) 01107 //store bar -> b 01108 //vacopy(a, b) 01109 //foo = load a 01110 01111 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); 01112 const Type* ArgTy = F->getFunctionType()->getReturnType(); 01113 const Type* ArgTyPtr = PointerType::get(ArgTy); 01114 Function* NF = Result->getOrInsertFunction("llvm.va_copy", 01115 RetTy, ArgTyPtr, ArgTyPtr, 01116 (Type *)0); 01117 01118 while (!F->use_empty()) { 01119 CallInst* CI = cast<CallInst>(F->use_back()); 01120 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); 01121 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); 01122 new StoreInst(CI->getOperand(1), b, CI); 01123 new CallInst(NF, a, b, "", CI); 01124 Value* foo = new LoadInst(a, "vacopy.fix.3", CI); 01125 CI->replaceAllUsesWith(foo); 01126 CI->getParent()->getInstList().erase(CI); 01127 } 01128 Result->getFunctionList().erase(F); 01129 } 01130 } 01131 01132 return Result; 01133 01134 } 01135 01136 //===----------------------------------------------------------------------===// 01137 // RunVMAsmParser - Define an interface to this parser 01138 //===----------------------------------------------------------------------===// 01139 // 01140 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { 01141 set_scan_file(F); 01142 01143 CurFilename = Filename; 01144 return RunParser(new Module(CurFilename)); 01145 } 01146 01147 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { 01148 set_scan_string(AsmString); 01149 01150 CurFilename = "from_memory"; 01151 if (M == NULL) { 01152 return RunParser(new Module (CurFilename)); 01153 } else { 01154 return RunParser(M); 01155 } 01156 } 01157 01158 01159 01160 /* Enabling traces. */ 01161 #ifndef YYDEBUG 01162 # define YYDEBUG 0 01163 #endif 01164 01165 /* Enabling verbose error messages. */ 01166 #ifdef YYERROR_VERBOSE 01167 # undef YYERROR_VERBOSE 01168 # define YYERROR_VERBOSE 1 01169 #else 01170 # define YYERROR_VERBOSE 0 01171 #endif 01172 01173 /* Enabling the token table. */ 01174 #ifndef YYTOKEN_TABLE 01175 # define YYTOKEN_TABLE 0 01176 #endif 01177 01178 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 01179 typedef union YYSTYPE 01180 #line 890 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 01181 { 01182 llvm::Module *ModuleVal; 01183 llvm::Function *FunctionVal; 01184 std::pair<llvm::PATypeHolder*, char*> *ArgVal; 01185 llvm::BasicBlock *BasicBlockVal; 01186 llvm::TerminatorInst *TermInstVal; 01187 llvm::Instruction *InstVal; 01188 llvm::Constant *ConstVal; 01189 01190 const llvm::Type *PrimType; 01191 llvm::PATypeHolder *TypeVal; 01192 llvm::Value *ValueVal; 01193 01194 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList; 01195 std::vector<llvm::Value*> *ValueList; 01196 std::list<llvm::PATypeHolder> *TypeList; 01197 // Represent the RHS of PHI node 01198 std::list<std::pair<llvm::Value*, 01199 llvm::BasicBlock*> > *PHIList; 01200 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; 01201 std::vector<llvm::Constant*> *ConstVector; 01202 01203 llvm::GlobalValue::LinkageTypes Linkage; 01204 int64_t SInt64Val; 01205 uint64_t UInt64Val; 01206 int SIntVal; 01207 unsigned UIntVal; 01208 double FPVal; 01209 bool BoolVal; 01210 01211 char *StrVal; // This memory is strdup'd! 01212 llvm::ValID ValIDVal; // strdup'd memory maybe! 01213 01214 llvm::Instruction::BinaryOps BinaryOpVal; 01215 llvm::Instruction::TermOps TermOpVal; 01216 llvm::Instruction::MemoryOps MemOpVal; 01217 llvm::Instruction::OtherOps OtherOpVal; 01218 llvm::Module::Endianness Endianness; 01219 } 01220 /* Line 193 of yacc.c. */ 01221 #line 1222 "llvmAsmParser.tab.c" 01222 YYSTYPE; 01223 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 01224 # define YYSTYPE_IS_DECLARED 1 01225 # define YYSTYPE_IS_TRIVIAL 1 01226 #endif 01227 01228 01229 01230 /* Copy the second part of user declarations. */ 01231 01232 01233 /* Line 216 of yacc.c. */ 01234 #line 1235 "llvmAsmParser.tab.c" 01235 01236 #ifdef short 01237 # undef short 01238 #endif 01239 01240 #ifdef YYTYPE_UINT8 01241 typedef YYTYPE_UINT8 yytype_uint8; 01242 #else 01243 typedef unsigned char yytype_uint8; 01244 #endif 01245 01246 #ifdef YYTYPE_INT8 01247 typedef YYTYPE_INT8 yytype_int8; 01248 #elif (defined __STDC__ || defined __C99__FUNC__ \ 01249 || defined __cplusplus || defined _MSC_VER) 01250 typedef signed char yytype_int8; 01251 #else 01252 typedef short int yytype_int8; 01253 #endif 01254 01255 #ifdef YYTYPE_UINT16 01256 typedef YYTYPE_UINT16 yytype_uint16; 01257 #else 01258 typedef unsigned short int yytype_uint16; 01259 #endif 01260 01261 #ifdef YYTYPE_INT16 01262 typedef YYTYPE_INT16 yytype_int16; 01263 #else 01264 typedef short int yytype_int16; 01265 #endif 01266 01267 #ifndef YYSIZE_T 01268 # ifdef __SIZE_TYPE__ 01269 # define YYSIZE_T __SIZE_TYPE__ 01270 # elif defined size_t 01271 # define YYSIZE_T size_t 01272 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 01273 || defined __cplusplus || defined _MSC_VER) 01274 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 01275 # define YYSIZE_T size_t 01276 # else 01277 # define YYSIZE_T unsigned int 01278 # endif 01279 #endif 01280 01281 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 01282 01283 #ifndef YY_ 01284 # if YYENABLE_NLS 01285 # if ENABLE_NLS 01286 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 01287 # define YY_(msgid) dgettext ("bison-runtime", msgid) 01288 # endif 01289 # endif 01290 # ifndef YY_ 01291 # define YY_(msgid) msgid 01292 # endif 01293 #endif 01294 01295 /* Suppress unused-variable warnings by "using" E. */ 01296 #if ! defined lint || defined __GNUC__ 01297 # define YYUSE(e) ((void) (e)) 01298 #else 01299 # define YYUSE(e) /* empty */ 01300 #endif 01301 01302 /* Identity function, used to suppress warnings about constant conditions. */ 01303 #ifndef lint 01304 # define YYID(n) (n) 01305 #else 01306 #if (defined __STDC__ || defined __C99__FUNC__ \ 01307 || defined __cplusplus || defined _MSC_VER) 01308 static int 01309 YYID (int i) 01310 #else 01311 static int 01312 YYID (i) 01313 int i; 01314 #endif 01315 { 01316 return i; 01317 } 01318 #endif 01319 01320 #if ! defined yyoverflow || YYERROR_VERBOSE 01321 01322 /* The parser invokes alloca or malloc; define the necessary symbols. */ 01323 01324 # ifdef YYSTACK_USE_ALLOCA 01325 # if YYSTACK_USE_ALLOCA 01326 # ifdef __GNUC__ 01327 # define YYSTACK_ALLOC __builtin_alloca 01328 # elif defined __BUILTIN_VA_ARG_INCR 01329 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 01330 # elif defined _AIX 01331 # define YYSTACK_ALLOC __alloca 01332 # elif defined _MSC_VER 01333 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 01334 # define alloca _alloca 01335 # else 01336 # define YYSTACK_ALLOC alloca 01337 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 01338 || defined __cplusplus || defined _MSC_VER) 01339 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 01340 # ifndef _STDLIB_H 01341 # define _STDLIB_H 1 01342 # endif 01343 # endif 01344 # endif 01345 # endif 01346 # endif 01347 01348 # ifdef YYSTACK_ALLOC 01349 /* Pacify GCC's `empty if-body' warning. */ 01350 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 01351 # ifndef YYSTACK_ALLOC_MAXIMUM 01352 /* The OS might guarantee only one guard page at the bottom of the stack, 01353 and a page size can be as small as 4096 bytes. So we cannot safely 01354 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 01355 to allow for a few compiler-allocated temporary stack slots. */ 01356 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 01357 # endif 01358 # else 01359 # define YYSTACK_ALLOC YYMALLOC 01360 # define YYSTACK_FREE YYFREE 01361 # ifndef YYSTACK_ALLOC_MAXIMUM 01362 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 01363 # endif 01364 # if (defined __cplusplus && ! defined _STDLIB_H \ 01365 && ! ((defined YYMALLOC || defined malloc) \ 01366 && (defined YYFREE || defined free))) 01367 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 01368 # ifndef _STDLIB_H 01369 # define _STDLIB_H 1 01370 # endif 01371 # endif 01372 # ifndef YYMALLOC 01373 # define YYMALLOC malloc 01374 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 01375 || defined __cplusplus || defined _MSC_VER) 01376 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 01377 # endif 01378 # endif 01379 # ifndef YYFREE 01380 # define YYFREE free 01381 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 01382 || defined __cplusplus || defined _MSC_VER) 01383 void free (void *); /* INFRINGES ON USER NAME SPACE */ 01384 # endif 01385 # endif 01386 # endif 01387 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 01388 01389 01390 #if (! defined yyoverflow \ 01391 && (! defined __cplusplus \ 01392 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 01393 01394 /* A type that is properly aligned for any stack member. */ 01395 union yyalloc 01396 { 01397 yytype_int16 yyss; 01398 YYSTYPE yyvs; 01399 }; 01400 01401 /* The size of the maximum gap between one aligned stack and the next. */ 01402 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 01403 01404 /* The size of an array large to enough to hold all stacks, each with 01405 N elements. */ 01406 # define YYSTACK_BYTES(N) \ 01407 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 01408 + YYSTACK_GAP_MAXIMUM) 01409 01410 /* Copy COUNT objects from FROM to TO. The source and destination do 01411 not overlap. */ 01412 # ifndef YYCOPY 01413 # if defined __GNUC__ && 1 < __GNUC__ 01414 # define YYCOPY(To, From, Count) \ 01415 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 01416 # else 01417 # define YYCOPY(To, From, Count) \ 01418 do \ 01419 { \ 01420 YYSIZE_T yyi; \ 01421 for (yyi = 0; yyi < (Count); yyi++) \ 01422 (To)[yyi] = (From)[yyi]; \ 01423 } \ 01424 while (YYID (0)) 01425 # endif 01426 # endif 01427 01428 /* Relocate STACK from its old location to the new one. The 01429 local variables YYSIZE and YYSTACKSIZE give the old and new number of 01430 elements in the stack, and YYPTR gives the new location of the 01431 stack. Advance YYPTR to a properly aligned location for the next 01432 stack. */ 01433 # define YYSTACK_RELOCATE(Stack) \ 01434 do \ 01435 { \ 01436 YYSIZE_T yynewbytes; \ 01437 YYCOPY (&yyptr->Stack, Stack, yysize); \ 01438 Stack = &yyptr->Stack; \ 01439 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 01440 yyptr += yynewbytes / sizeof (*yyptr); \ 01441 } \ 01442 while (YYID (0)) 01443 01444 #endif 01445 01446 /* YYFINAL -- State number of the termination state. */ 01447 #define YYFINAL 4 01448 /* YYLAST -- Last index in YYTABLE. */ 01449 #define YYLAST 1314 01450 01451 /* YYNTOKENS -- Number of terminals. */ 01452 #define YYNTOKENS 116 01453 /* YYNNTS -- Number of nonterminals. */ 01454 #define YYNNTS 72 01455 /* YYNRULES -- Number of rules. */ 01456 #define YYNRULES 238 01457 /* YYNRULES -- Number of states. */ 01458 #define YYNSTATES 495 01459 01460 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 01461 #define YYUNDEFTOK 2 01462 #define YYMAXUTOK 356 01463 01464 #define YYTRANSLATE(YYX) \ 01465 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 01466 01467 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 01468 static const yytype_uint8 yytranslate[] = 01469 { 01470 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01474 105, 106, 114, 2, 103, 2, 2, 2, 2, 2, 01475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01476 110, 102, 111, 2, 2, 2, 2, 2, 2, 2, 01477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01479 2, 107, 104, 109, 2, 2, 2, 2, 2, 115, 01480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01482 108, 2, 2, 112, 2, 113, 2, 2, 2, 2, 01483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01495 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 01496 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 01497 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 01498 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 01499 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 01500 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 01501 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 01502 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 01503 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 01504 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 01505 95, 96, 97, 98, 99, 100, 101 01506 }; 01507 01508 #if YYDEBUG 01509 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 01510 YYRHS. */ 01511 static const yytype_uint16 yyprhs[] = 01512 { 01513 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 01514 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 01515 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 01516 59, 61, 63, 65, 67, 70, 71, 73, 75, 77, 01517 79, 80, 81, 83, 85, 87, 90, 91, 94, 95, 01518 99, 102, 103, 105, 106, 110, 112, 115, 117, 119, 01519 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 01520 141, 143, 145, 147, 149, 151, 153, 155, 157, 160, 01521 165, 171, 177, 181, 184, 187, 189, 193, 195, 199, 01522 201, 202, 207, 211, 215, 220, 225, 229, 232, 235, 01523 238, 241, 244, 247, 250, 253, 256, 259, 266, 272, 01524 281, 288, 295, 302, 309, 316, 325, 334, 338, 340, 01525 342, 344, 346, 349, 352, 357, 360, 362, 367, 370, 01526 375, 376, 384, 385, 393, 397, 402, 403, 405, 407, 01527 409, 413, 417, 421, 425, 429, 431, 432, 434, 436, 01528 438, 439, 442, 446, 448, 450, 454, 456, 457, 466, 01529 468, 470, 474, 476, 478, 481, 482, 486, 487, 489, 01530 491, 493, 495, 497, 499, 501, 503, 505, 509, 511, 01531 517, 519, 521, 523, 525, 528, 531, 534, 538, 541, 01532 542, 544, 547, 550, 554, 564, 574, 583, 597, 599, 01533 601, 608, 614, 617, 624, 632, 634, 638, 640, 641, 01534 644, 646, 652, 658, 664, 667, 672, 677, 684, 689, 01535 694, 699, 704, 711, 718, 721, 729, 731, 734, 735, 01536 737, 738, 742, 749, 753, 760, 763, 768, 775 01537 }; 01538 01539 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 01540 static const yytype_int16 yyrhs[] = 01541 { 01542 147, 0, -1, 5, -1, 6, -1, 3, -1, 4, 01543 -1, 71, -1, 72, -1, 73, -1, 74, -1, 75, 01544 -1, 76, -1, 77, -1, 78, -1, 79, -1, 80, 01545 -1, 81, -1, 82, -1, 83, -1, 84, -1, 94, 01546 -1, 95, -1, 16, -1, 14, -1, 12, -1, 10, 01547 -1, 17, -1, 15, -1, 13, -1, 11, -1, 123, 01548 -1, 124, -1, 18, -1, 19, -1, 157, 102, -1, 01549 -1, 41, -1, 42, -1, 43, -1, 44, -1, -1, 01550 -1, 62, -1, 63, -1, 64, -1, 61, 4, -1, 01551 -1, 54, 4, -1, -1, 103, 54, 4, -1, 34, 01552 24, -1, -1, 132, -1, -1, 103, 135, 134, -1, 01553 132, -1, 54, 4, -1, 138, -1, 8, -1, 140, 01554 -1, 8, -1, 140, -1, 9, -1, 10, -1, 11, 01555 -1, 12, -1, 13, -1, 14, -1, 15, -1, 16, 01556 -1, 17, -1, 18, -1, 19, -1, 20, -1, 21, 01557 -1, 45, -1, 139, -1, 171, -1, 104, 4, -1, 01558 137, 105, 142, 106, -1, 107, 4, 108, 140, 109, 01559 -1, 110, 4, 108, 140, 111, -1, 112, 141, 113, 01560 -1, 112, 113, -1, 140, 114, -1, 140, -1, 141, 01561 103, 140, -1, 141, -1, 141, 103, 37, -1, 37, 01562 -1, -1, 138, 107, 145, 109, -1, 138, 107, 109, 01563 -1, 138, 115, 24, -1, 138, 110, 145, 111, -1, 01564 138, 112, 145, 113, -1, 138, 112, 113, -1, 138, 01565 38, -1, 138, 39, -1, 138, 171, -1, 138, 144, 01566 -1, 138, 26, -1, 123, 118, -1, 124, 4, -1, 01567 9, 27, -1, 9, 28, -1, 126, 7, -1, 92, 01568 105, 143, 36, 138, 106, -1, 90, 105, 143, 185, 01569 106, -1, 93, 105, 143, 103, 143, 103, 143, 106, 01570 -1, 119, 105, 143, 103, 143, 106, -1, 120, 105, 01571 143, 103, 143, 106, -1, 121, 105, 143, 103, 143, 01572 106, -1, 122, 105, 143, 103, 143, 106, -1, 97, 01573 105, 143, 103, 143, 106, -1, 98, 105, 143, 103, 01574 143, 103, 143, 106, -1, 99, 105, 143, 103, 143, 01575 103, 143, 106, -1, 145, 103, 143, -1, 143, -1, 01576 32, -1, 33, -1, 148, -1, 148, 166, -1, 148, 01577 167, -1, 148, 59, 58, 152, -1, 148, 25, -1, 01578 149, -1, 149, 127, 20, 136, -1, 149, 167, -1, 01579 149, 59, 58, 152, -1, -1, 149, 127, 128, 146, 01580 143, 150, 134, -1, -1, 149, 127, 47, 146, 138, 01581 151, 134, -1, 149, 48, 154, -1, 149, 55, 102, 01582 155, -1, -1, 24, -1, 53, -1, 52, -1, 50, 01583 102, 153, -1, 51, 102, 4, -1, 49, 102, 24, 01584 -1, 107, 156, 109, -1, 156, 103, 24, -1, 24, 01585 -1, -1, 22, -1, 24, -1, 157, -1, -1, 138, 01586 158, -1, 160, 103, 159, -1, 159, -1, 160, -1, 01587 160, 103, 37, -1, 37, -1, -1, 129, 136, 157, 01588 105, 161, 106, 133, 130, -1, 29, -1, 112, -1, 01589 128, 162, 163, -1, 30, -1, 113, -1, 174, 165, 01590 -1, -1, 31, 168, 162, -1, -1, 60, -1, 3, 01591 -1, 4, -1, 7, -1, 27, -1, 28, -1, 38, 01592 -1, 39, -1, 26, -1, 110, 145, 111, -1, 144, 01593 -1, 58, 169, 24, 103, 24, -1, 117, -1, 157, 01594 -1, 171, -1, 170, -1, 138, 172, -1, 174, 175, 01595 -1, 164, 175, -1, 176, 127, 177, -1, 176, 179, 01596 -1, -1, 23, -1, 65, 173, -1, 65, 8, -1, 01597 66, 21, 172, -1, 66, 9, 172, 103, 21, 172, 01598 103, 21, 172, -1, 67, 125, 172, 103, 21, 172, 01599 107, 178, 109, -1, 67, 125, 172, 103, 21, 172, 01600 107, 109, -1, 68, 129, 136, 172, 105, 182, 106, 01601 36, 21, 172, 69, 21, 172, -1, 69, -1, 70, 01602 -1, 178, 125, 170, 103, 21, 172, -1, 125, 170, 01603 103, 21, 172, -1, 127, 184, -1, 138, 107, 172, 01604 103, 172, 109, -1, 180, 103, 107, 172, 103, 172, 01605 109, -1, 173, -1, 181, 103, 173, -1, 181, -1, 01606 -1, 57, 56, -1, 56, -1, 119, 138, 172, 103, 01607 172, -1, 120, 138, 172, 103, 172, -1, 121, 138, 01608 172, 103, 172, -1, 46, 173, -1, 122, 173, 103, 01609 173, -1, 92, 173, 36, 138, -1, 93, 173, 103, 01610 173, 103, 173, -1, 96, 173, 103, 138, -1, 100, 01611 173, 103, 138, -1, 101, 173, 103, 138, -1, 97, 01612 173, 103, 173, -1, 98, 173, 103, 173, 103, 173, 01613 -1, 99, 173, 103, 173, 103, 173, -1, 91, 180, 01614 -1, 183, 129, 136, 172, 105, 182, 106, -1, 187, 01615 -1, 103, 181, -1, -1, 35, -1, -1, 85, 138, 01616 131, -1, 85, 138, 103, 15, 172, 131, -1, 86, 01617 138, 131, -1, 86, 138, 103, 15, 172, 131, -1, 01618 87, 173, -1, 186, 88, 138, 172, -1, 186, 89, 01619 173, 103, 138, 172, -1, 90, 138, 172, 185, -1 01620 }; 01621 01622 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 01623 static const yytype_uint16 yyrline[] = 01624 { 01625 0, 1010, 1010, 1011, 1018, 1019, 1028, 1028, 1028, 1028, 01626 1028, 1029, 1029, 1029, 1030, 1030, 1030, 1030, 1030, 1030, 01627 1032, 1032, 1036, 1036, 1036, 1036, 1037, 1037, 1037, 1037, 01628 1038, 1038, 1039, 1039, 1042, 1045, 1049, 1050, 1051, 1052, 01629 1053, 1055, 1056, 1057, 1058, 1059, 1067, 1068, 1073, 1074, 01630 1081, 1088, 1089, 1094, 1095, 1096, 1100, 1113, 1113, 1114, 01631 1114, 1116, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1126, 01632 1126, 1126, 1126, 1126, 1126, 1127, 1130, 1133, 1139, 1146, 01633 1158, 1162, 1173, 1182, 1185, 1193, 1197, 1202, 1203, 1206, 01634 1209, 1219, 1244, 1257, 1286, 1311, 1331, 1343, 1352, 1356, 01635 1415, 1421, 1429, 1434, 1439, 1442, 1445, 1452, 1462, 1493, 01636 1500, 1521, 1531, 1536, 1543, 1548, 1553, 1561, 1564, 1571, 01637 1571, 1581, 1588, 1592, 1595, 1598, 1601, 1614, 1634, 1636, 01638 1638, 1638, 1644, 1644, 1651, 1653, 1655, 1659, 1671, 1672, 01639 1674, 1677, 1685, 1690, 1692, 1696, 1700, 1708, 1708, 1709, 01640 1709, 1711, 1717, 1722, 1728, 1731, 1736, 1740, 1744, 1830, 01641 1830, 1832, 1840, 1840, 1842, 1846, 1846, 1855, 1858, 1862, 01642 1865, 1868, 1871, 1874, 1877, 1880, 1883, 1886, 1910, 1913, 01643 1926, 1929, 1934, 1934, 1940, 1944, 1947, 1955, 1964, 1968, 01644 1978, 1989, 1992, 1995, 1998, 2001, 2015, 2019, 2072, 2075, 01645 2081, 2089, 2099, 2106, 2111, 2118, 2122, 2128, 2128, 2130, 01646 2133, 2139, 2151, 2162, 2172, 2184, 2191, 2198, 2205, 2210, 01647 2229, 2251, 2256, 2261, 2266, 2280, 2337, 2343, 2345, 2349, 01648 2352, 2358, 2362, 2366, 2370, 2374, 2381, 2391, 2404 01649 }; 01650 #endif 01651 01652 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 01653 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 01654 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 01655 static const char *const yytname[] = 01656 { 01657 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", 01658 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", 01659 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", 01660 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", 01661 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", 01662 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", 01663 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", 01664 "WEAK", "APPENDING", "OPAQUE", "NOT", "EXTERNAL", "TARGET", "TRIPLE", 01665 "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS", "CALL", 01666 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", 01667 "FASTCC_TOK", "COLDCC_TOK", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", 01668 "UNREACHABLE", "ADD", "SUB", "MUL", "DIV", "REM", "AND", "OR", "XOR", 01669 "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC", "ALLOCA", 01670 "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK", "CAST", "SELECT", 01671 "SHL", "SHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", 01672 "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='", "','", "'\\\\'", 01673 "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", 01674 "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", 01675 "SetCondOps", "ShiftOps", "SIntType", "UIntType", "IntType", "FPType", 01676 "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", 01677 "SectionString", "OptSection", "GlobalVarAttributes", 01678 "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType", 01679 "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr", 01680 "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1", 01681 "@2", "AsmBlock", "BigOrLittle", "TargetDefinition", 01682 "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", 01683 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", 01684 "END", "Function", "FunctionProto", "@3", "OptSideEffect", 01685 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", 01686 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", 01687 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE", 01688 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0 01689 }; 01690 #endif 01691 01692 # ifdef YYPRINT 01693 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 01694 token YYLEX-NUM. */ 01695 static const yytype_uint16 yytoknum[] = 01696 { 01697 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 01698 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 01699 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 01700 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 01701 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 01702 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 01703 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 01704 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 01705 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 01706 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 01707 355, 356, 61, 44, 92, 40, 41, 91, 120, 93, 01708 60, 62, 123, 125, 42, 99 01709 }; 01710 # endif 01711 01712 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 01713 static const yytype_uint8 yyr1[] = 01714 { 01715 0, 116, 117, 117, 118, 118, 119, 119, 119, 119, 01716 119, 120, 120, 120, 121, 121, 121, 121, 121, 121, 01717 122, 122, 123, 123, 123, 123, 124, 124, 124, 124, 01718 125, 125, 126, 126, 127, 127, 128, 128, 128, 128, 01719 128, 129, 129, 129, 129, 129, 130, 130, 131, 131, 01720 132, 133, 133, 134, 134, 135, 135, 136, 136, 137, 01721 137, 138, 139, 139, 139, 139, 139, 139, 139, 139, 01722 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 01723 140, 140, 140, 140, 140, 141, 141, 142, 142, 142, 01724 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 01725 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 01726 144, 144, 144, 144, 144, 144, 144, 145, 145, 146, 01727 146, 147, 148, 148, 148, 148, 148, 149, 149, 149, 01728 150, 149, 151, 149, 149, 149, 149, 152, 153, 153, 01729 154, 154, 154, 155, 156, 156, 156, 157, 157, 158, 01730 158, 159, 160, 160, 161, 161, 161, 161, 162, 163, 01731 163, 164, 165, 165, 166, 168, 167, 169, 169, 170, 01732 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 01733 171, 171, 172, 172, 173, 174, 174, 175, 176, 176, 01734 176, 177, 177, 177, 177, 177, 177, 177, 177, 177, 01735 178, 178, 179, 180, 180, 181, 181, 182, 182, 183, 01736 183, 184, 184, 184, 184, 184, 184, 184, 184, 184, 01737 184, 184, 184, 184, 184, 184, 184, 185, 185, 186, 01738 186, 187, 187, 187, 187, 187, 187, 187, 187 01739 }; 01740 01741 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 01742 static const yytype_uint8 yyr2[] = 01743 { 01744 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 01745 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 01746 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 01747 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 01748 0, 0, 1, 1, 1, 2, 0, 2, 0, 3, 01749 2, 0, 1, 0, 3, 1, 2, 1, 1, 1, 01750 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 01751 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 01752 5, 5, 3, 2, 2, 1, 3, 1, 3, 1, 01753 0, 4, 3, 3, 4, 4, 3, 2, 2, 2, 01754 2, 2, 2, 2, 2, 2, 2, 6, 5, 8, 01755 6, 6, 6, 6, 6, 8, 8, 3, 1, 1, 01756 1, 1, 2, 2, 4, 2, 1, 4, 2, 4, 01757 0, 7, 0, 7, 3, 4, 0, 1, 1, 1, 01758 3, 3, 3, 3, 3, 1, 0, 1, 1, 1, 01759 0, 2, 3, 1, 1, 3, 1, 0, 8, 1, 01760 1, 3, 1, 1, 2, 0, 3, 0, 1, 1, 01761 1, 1, 1, 1, 1, 1, 1, 3, 1, 5, 01762 1, 1, 1, 1, 2, 2, 2, 3, 2, 0, 01763 1, 2, 2, 3, 9, 9, 8, 13, 1, 1, 01764 6, 5, 2, 6, 7, 1, 3, 1, 0, 2, 01765 1, 5, 5, 5, 2, 4, 4, 6, 4, 4, 01766 4, 4, 6, 6, 2, 7, 1, 2, 0, 1, 01767 0, 3, 6, 3, 6, 2, 4, 6, 4 01768 }; 01769 01770 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 01771 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 01772 means the default is an error. */ 01773 static const yytype_uint8 yydefact[] = 01774 { 01775 136, 0, 40, 126, 1, 125, 165, 36, 37, 38, 01776 39, 0, 41, 189, 122, 123, 189, 147, 148, 0, 01777 0, 0, 40, 0, 128, 41, 0, 0, 42, 43, 01778 44, 0, 0, 190, 186, 35, 162, 163, 164, 185, 01779 0, 0, 0, 134, 0, 0, 0, 0, 0, 34, 01780 166, 137, 124, 45, 2, 3, 58, 62, 63, 64, 01781 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 01782 75, 0, 0, 0, 0, 180, 0, 0, 57, 76, 01783 61, 181, 77, 159, 160, 161, 230, 188, 0, 0, 01784 0, 146, 135, 129, 127, 119, 120, 0, 0, 78, 01785 0, 0, 60, 83, 85, 0, 0, 90, 84, 229, 01786 0, 210, 0, 0, 0, 0, 41, 198, 199, 6, 01787 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 01788 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 01789 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, 01790 0, 0, 187, 41, 202, 0, 226, 142, 139, 138, 01791 140, 141, 145, 0, 132, 62, 63, 64, 65, 66, 01792 67, 68, 69, 70, 71, 72, 0, 0, 0, 0, 01793 130, 0, 0, 0, 82, 157, 89, 87, 0, 0, 01794 214, 209, 192, 191, 0, 0, 25, 29, 24, 28, 01795 23, 27, 22, 26, 30, 31, 0, 0, 48, 48, 01796 235, 0, 0, 224, 0, 0, 0, 0, 0, 0, 01797 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01798 143, 53, 104, 105, 4, 5, 102, 103, 106, 101, 01799 97, 98, 0, 0, 0, 0, 0, 0, 0, 0, 01800 0, 0, 0, 0, 0, 0, 100, 99, 53, 59, 01801 59, 86, 156, 150, 153, 154, 0, 0, 79, 169, 01802 170, 171, 176, 172, 173, 174, 175, 167, 0, 178, 01803 183, 182, 184, 0, 193, 0, 0, 0, 231, 0, 01804 233, 228, 0, 0, 0, 0, 0, 0, 0, 0, 01805 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 01806 0, 133, 0, 0, 0, 0, 0, 0, 92, 118, 01807 0, 0, 96, 0, 93, 0, 0, 0, 0, 131, 01808 80, 81, 149, 151, 0, 51, 88, 168, 0, 0, 01809 0, 0, 0, 0, 0, 0, 0, 238, 0, 0, 01810 216, 0, 218, 221, 0, 0, 219, 220, 0, 0, 01811 0, 215, 0, 236, 0, 0, 0, 55, 53, 228, 01812 0, 0, 0, 0, 0, 0, 91, 94, 95, 0, 01813 0, 0, 0, 155, 152, 52, 46, 0, 177, 0, 01814 0, 208, 48, 49, 48, 205, 227, 0, 0, 0, 01815 0, 0, 211, 212, 213, 208, 0, 50, 56, 54, 01816 0, 0, 0, 0, 0, 0, 117, 0, 0, 0, 01817 0, 0, 158, 0, 0, 0, 207, 0, 0, 232, 01818 234, 0, 0, 0, 217, 222, 223, 0, 237, 108, 01819 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 01820 179, 0, 0, 0, 206, 203, 0, 225, 107, 0, 01821 114, 0, 0, 110, 111, 112, 113, 0, 196, 0, 01822 0, 0, 204, 0, 0, 0, 194, 0, 195, 0, 01823 0, 109, 115, 116, 0, 0, 0, 0, 0, 0, 01824 201, 0, 0, 200, 197 01825 }; 01826 01827 /* YYDEFGOTO[NTERM-NUM]. */ 01828 static const yytype_int16 yydefgoto[] = 01829 { 01830 -1, 75, 236, 252, 253, 254, 255, 176, 177, 206, 01831 178, 22, 12, 31, 422, 288, 367, 386, 311, 368, 01832 76, 77, 179, 79, 80, 105, 188, 319, 279, 320, 01833 97, 1, 2, 3, 258, 231, 52, 160, 43, 92, 01834 163, 81, 333, 264, 265, 266, 32, 85, 13, 38, 01835 14, 15, 25, 338, 280, 82, 282, 395, 16, 34, 01836 35, 152, 470, 87, 213, 426, 427, 153, 154, 347, 01837 155, 156 01838 }; 01839 01840 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 01841 STATE-NUM. */ 01842 #define YYPACT_NINF -441 01843 static const yytype_int16 yypact[] = 01844 { 01845 -441, 26, 181, 364, -441, -441, -441, -441, -441, -441, 01846 -441, 6, 33, 60, -441, -441, -14, -441, -441, 79, 01847 -2, 40, 45, 7, -441, 33, 110, 145, -441, -441, 01848 -441, 1050, -21, -441, -441, 22, -441, -441, -441, -441, 01849 61, 67, 68, -441, 64, 110, 1050, 29, 29, -441, 01850 -441, -441, -441, -441, -441, -441, 70, -441, -441, -441, 01851 -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, 01852 -441, 168, 169, 170, 566, -441, 22, 72, -441, -441, 01853 -4, -441, -441, -441, -441, -441, 1213, -441, 155, 28, 01854 174, 159, -441, -441, -441, -441, -441, 1088, 1126, -441, 01855 74, 76, -441, -441, -4, -82, 75, 860, -441, -441, 01856 1088, -441, 129, 1164, 69, 128, 33, -441, -441, -441, 01857 -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, 01858 -441, -441, -441, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 01859 -441, -441, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 01860 1088, 1088, -441, 33, -441, 44, -441, -441, -441, -441, 01861 -441, -441, -441, -81, -441, 119, 148, 183, 152, 190, 01862 154, 194, 156, 196, 195, 197, 158, 199, 198, 425, 01863 -441, 1088, 1088, 1088, -441, 898, -441, 98, 101, 660, 01864 -441, -441, 70, -441, 660, 660, -441, -441, -441, -441, 01865 -441, -441, -441, -441, -441, -441, 660, 1050, 105, 106, 01866 -441, 660, 104, 111, 177, 112, 123, 124, 130, 132, 01867 133, 134, 660, 660, 660, 135, 1050, 1088, 1088, 215, 01868 -441, 138, -441, -441, -441, -441, -441, -441, -441, -441, 01869 -441, -441, 137, 139, 140, 141, 142, 146, 936, 1126, 01870 604, 219, 147, 149, 150, 151, -441, -441, 138, -46, 01871 -87, -4, -441, 22, -441, 157, 144, 974, -441, -441, 01872 -441, -441, -441, -441, -441, -441, -441, 193, 1126, -441, 01873 -441, -441, -441, 172, -441, 173, 660, -5, -441, 5, 01874 -441, 175, 660, 165, 1088, 1088, 1088, 1088, 1088, 1088, 01875 1088, 1088, 178, 179, 180, 1088, 660, 660, 185, -441, 01876 -20, -441, 1126, 1126, 1126, 1126, 1126, 1126, -441, -441, 01877 -61, -18, -441, -78, -441, 1126, 1126, 1126, 1126, -441, 01878 -441, -441, -441, -441, 1012, 223, -441, -441, 234, 24, 01879 238, 240, 184, 660, 258, 660, 1088, -441, 187, 660, 01880 -441, 189, -441, -441, 201, 202, -441, -441, 660, 660, 01881 660, -441, 191, -441, 1088, 249, 273, -441, 138, 175, 01882 244, 203, 204, 205, 206, 1126, -441, -441, -441, 207, 01883 208, 209, 210, -441, -441, -441, 230, 211, -441, 660, 01884 660, 1088, 217, -441, 217, -441, 224, 660, 225, 1088, 01885 1088, 1088, -441, -441, -441, 1088, 660, -441, -441, -441, 01886 192, 1088, 1126, 1126, 1126, 1126, -441, 1126, 1126, 1126, 01887 1126, 282, -441, 275, 226, 227, 224, 220, 243, -441, 01888 -441, 1088, 221, 660, -441, -441, -441, 229, -441, -441, 01889 231, 233, 235, 239, 241, 237, 245, 246, 247, -441, 01890 -441, 324, 41, 310, -441, -441, 248, -441, -441, 1126, 01891 -441, 1126, 1126, -441, -441, -441, -441, 660, -441, 757, 01892 59, 326, -441, 253, 261, 265, -441, 251, -441, 757, 01893 660, -441, -441, -441, 328, 252, 281, 660, 343, 351, 01894 -441, 660, 660, -441, -441 01895 }; 01896 01897 /* YYPGOTO[NTERM-NUM]. */ 01898 static const yytype_int16 yypgoto[] = 01899 { 01900 -441, -441, -441, 290, 291, 293, 295, -114, -112, -440, 01901 -441, 347, 361, -93, -441, -204, 50, -441, -245, -441, 01902 -40, -441, -31, -441, -57, 280, -441, -96, 213, -231, 01903 345, -441, -441, -441, -441, -441, 349, -441, -441, -441, 01904 -441, 8, -441, 65, -441, -441, 373, -441, -441, -441, 01905 -441, 398, -441, -441, -402, -58, 167, -106, -441, 386, 01906 -441, -441, -441, -441, -441, 57, -1, -441, -441, 46, 01907 -441, -441 01908 }; 01909 01910 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 01911 positive, shift that token. If negative, reduce the rule which 01912 number is the opposite. If zero, do what YYDEFACT says. 01913 If YYTABLE_NINF, syntax error. */ 01914 #define YYTABLE_NINF -122 01915 static const yytype_int16 yytable[] = 01916 { 01917 78, 204, 180, 205, 190, 290, 94, 193, 83, 33, 01918 343, 23, 469, 329, 365, 78, 36, 104, 321, 323, 01919 345, 183, 229, 207, 331, 375, 4, 108, 230, 210, 01920 479, 184, 214, 215, 366, 378, 216, 217, 218, 219, 01921 220, 221, 375, 23, 17, 225, 18, 339, 376, 344, 01922 104, 196, 197, 198, 199, 200, 201, 202, 203, 344, 01923 226, 95, 96, 330, 26, 46, 164, 477, 108, 196, 01924 197, 198, 199, 200, 201, 202, 203, 485, 194, 189, 01925 158, 159, 189, 33, 106, 375, 7, 8, 9, 10, 01926 195, 84, 47, 377, 27, 28, 29, 30, 45, 37, 01927 44, -59, 208, 209, 189, 211, 212, 189, 189, 49, 01928 108, 189, 189, 189, 189, 189, 189, 222, 223, 224, 01929 189, 257, 308, 409, 259, 260, 261, 375, 40, 41, 01930 42, 281, 227, 228, 51, 388, 281, 281, 196, 197, 01931 198, 199, 200, 201, 202, 203, 232, 233, 281, 53, 01932 468, -25, -25, 281, 263, -24, -24, -23, -23, -22, 01933 -22, 234, 235, 88, 281, 281, 281, 286, 478, 89, 01934 90, 91, 99, 100, 101, -60, 78, 107, 161, 157, 01935 185, -121, 181, 162, 182, 191, 306, -29, 429, 351, 01936 430, 353, 354, 355, -28, 78, 307, 189, -27, 361, 01937 -26, 267, -32, 237, -33, 238, 5, 268, 287, 289, 01938 261, 292, 6, 294, 293, 295, 369, 370, 371, 372, 01939 373, 374, 7, 8, 9, 10, 296, 297, 281, 379, 01940 380, 381, 382, 298, 281, 299, 300, 301, 305, 309, 01941 11, 310, 312, 324, 313, 314, 315, 316, 281, 281, 01942 335, 317, 325, 337, 326, 327, 328, 365, 387, 389, 01943 334, 390, 393, 350, 189, 352, 189, 189, 189, 356, 01944 357, 332, 349, 407, 189, 340, 341, 408, 346, 416, 01945 411, 358, 359, 360, 421, 281, 449, 281, 364, 391, 01946 397, 281, 399, 434, 435, 436, 405, 344, 439, 450, 01947 281, 281, 281, 263, 400, 401, 412, 413, 414, 415, 01948 417, 418, 419, 420, 423, 189, 441, 442, 443, 444, 01949 428, 445, 446, 447, 448, 454, 453, 431, 433, 451, 01950 455, 281, 281, 406, 452, 457, 459, 458, 204, 281, 01951 205, 460, 461, 463, 462, 467, 471, 480, 281, 487, 01952 489, 464, 465, 466, 484, 488, 204, 472, 205, 481, 01953 189, 283, 284, 473, 491, 474, 475, 482, 189, 189, 01954 189, 483, 492, 285, 189, 281, 148, 149, 291, 150, 01955 440, 151, 86, 48, -35, 385, 17, 187, 18, 302, 01956 303, 304, 256, 98, 93, 6, -35, -35, 50, 384, 01957 189, 24, 39, 396, 437, -35, -35, -35, -35, 281, 01958 0, -35, 19, 0, 0, 410, 0, 0, 0, 20, 01959 0, 0, 281, 21, 0, 0, 0, 0, 0, 281, 01960 54, 55, 0, 281, 281, 0, 0, 0, 0, 0, 01961 0, 0, 0, 0, 0, 0, 0, 17, 0, 18, 01962 0, 239, 0, 342, 0, 0, 0, 0, 0, 348, 01963 0, 0, 0, 240, 241, 0, 0, 0, 0, 0, 01964 0, 0, 0, 362, 363, 0, 0, 0, 0, 0, 01965 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01966 0, 0, 0, 0, 0, 0, 119, 120, 121, 122, 01967 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 01968 392, 0, 394, 0, 0, 242, 398, 243, 244, 140, 01969 141, 0, 245, 246, 247, 402, 403, 404, 0, 0, 01970 0, 0, 248, 0, 0, 249, 0, 250, 0, 0, 01971 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01972 0, 0, 0, 0, 0, 0, 424, 425, 0, 0, 01973 0, 0, 0, 0, 432, 0, 0, 0, 0, 0, 01974 0, 54, 55, 438, 102, 57, 58, 59, 60, 61, 01975 62, 63, 64, 65, 66, 67, 68, 69, 17, 0, 01976 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01977 456, 0, 0, 0, 0, 0, 0, 0, 0, 54, 01978 55, 70, 102, 165, 166, 167, 168, 169, 170, 171, 01979 172, 173, 174, 175, 68, 69, 17, 0, 18, 0, 01980 0, 0, 0, 0, 476, 0, 0, 0, 0, 0, 01981 0, 0, 0, 0, 0, 0, 0, 486, 0, 70, 01982 0, 0, 0, 0, 490, 0, 0, 0, 493, 494, 01983 0, 0, 0, 269, 270, 54, 55, 271, 0, 0, 01984 71, 0, 0, 72, 0, 0, 73, 0, 74, 103, 01985 0, 0, 17, 0, 18, 0, 272, 273, 274, 0, 01986 0, 0, 0, 0, 0, 0, 0, 0, 275, 276, 01987 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 01988 0, 72, 0, 0, 73, 0, 74, 322, 277, 0, 01989 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01990 0, 119, 120, 121, 122, 123, 124, 125, 126, 127, 01991 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 01992 242, 0, 243, 244, 140, 141, 0, 245, 246, 247, 01993 269, 270, 0, 0, 271, 0, 0, 0, 0, 0, 01994 278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01995 0, 0, 0, 272, 273, 274, 0, 0, 0, 0, 01996 0, 0, 0, 0, 0, 275, 276, 0, 0, 0, 01997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01998 0, 0, 0, 0, 0, 277, 0, 0, 0, 0, 01999 0, 0, 0, 0, 0, 0, 0, 0, 119, 120, 02000 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 02001 131, 132, 0, 0, 0, 0, 0, 242, 0, 243, 02002 244, 140, 141, 0, 245, 246, 247, 0, 0, 0, 02003 0, 0, 0, 0, 0, 54, 55, 278, 102, 57, 02004 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 02005 68, 69, 17, 0, 18, 0, 0, 0, 0, 0, 02006 0, 0, 0, 0, 0, 0, 0, 186, 0, 0, 02007 0, 0, 0, 54, 55, 70, 102, 57, 58, 59, 02008 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 02009 17, 0, 18, 0, 0, 0, 0, 0, 0, 0, 02010 0, 0, 0, 0, 0, 262, 0, 0, 0, 0, 02011 0, 54, 55, 70, 102, 165, 166, 167, 168, 169, 02012 170, 171, 172, 173, 174, 175, 68, 69, 17, 0, 02013 18, 0, 0, 0, 71, 0, 0, 72, 0, 0, 02014 73, 0, 74, 0, 0, 0, 0, 0, 0, 54, 02015 55, 70, 102, 57, 58, 59, 60, 61, 62, 63, 02016 64, 65, 66, 67, 68, 69, 17, 0, 18, 0, 02017 0, 0, 71, 0, 0, 72, 0, 0, 73, 0, 02018 74, 336, 0, 0, 0, 0, 0, 54, 55, 70, 02019 102, 57, 58, 59, 60, 61, 62, 63, 64, 65, 02020 66, 67, 68, 69, 17, 0, 18, 0, 0, 0, 02021 71, 0, 0, 72, 0, 318, 73, 0, 74, 383, 02022 0, 0, 0, 0, 0, 54, 55, 70, 56, 57, 02023 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 02024 68, 69, 17, 0, 18, 0, 0, 0, 71, 0, 02025 0, 72, 0, 0, 73, 0, 74, 0, 0, 0, 02026 0, 0, 0, 54, 55, 70, 102, 57, 58, 59, 02027 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 02028 17, 0, 18, 0, 0, 0, 71, 0, 0, 72, 02029 0, 0, 73, 0, 74, 0, 0, 0, 0, 0, 02030 0, 54, 55, 70, 102, 165, 166, 167, 168, 169, 02031 170, 171, 172, 173, 174, 175, 68, 69, 17, 0, 02032 18, 0, 0, 0, 71, 0, 0, 72, 0, 0, 02033 73, 0, 74, 0, 0, 0, 0, 0, 0, 54, 02034 55, 70, 192, 57, 58, 59, 60, 61, 62, 63, 02035 64, 65, 66, 67, 68, 69, 17, 0, 18, 0, 02036 0, 0, 71, 0, 0, 72, 0, 0, 73, 0, 02037 74, 0, 0, 0, 0, 0, 0, 0, 0, 70, 02038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 02039 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 02040 71, 0, 0, 72, 0, 0, 73, 0, 74, 0, 02041 0, 0, 0, 0, 0, 0, 0, 0, 109, 0, 02042 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, 02043 0, 0, 0, 0, 0, 0, 0, 0, 71, 111, 02044 112, 72, 0, 0, 73, 0, 74, 0, 113, 114, 02045 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 02046 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 02047 135, 0, 0, 136, 137, 138, 139, 140, 141, 142, 02048 143, 144, 145, 146, 147 02049 }; 02050 02051 static const yytype_int16 yycheck[] = 02052 { 02053 31, 115, 98, 115, 110, 209, 46, 113, 29, 23, 02054 15, 3, 452, 258, 34, 46, 30, 74, 249, 250, 02055 15, 103, 103, 116, 111, 103, 0, 114, 109, 135, 02056 470, 113, 138, 139, 54, 113, 142, 143, 144, 145, 02057 146, 147, 103, 35, 22, 151, 24, 278, 109, 54, 02058 107, 10, 11, 12, 13, 14, 15, 16, 17, 54, 02059 153, 32, 33, 109, 58, 20, 97, 469, 114, 10, 02060 11, 12, 13, 14, 15, 16, 17, 479, 9, 110, 02061 52, 53, 113, 23, 76, 103, 41, 42, 43, 44, 02062 21, 112, 47, 111, 61, 62, 63, 64, 58, 113, 02063 102, 105, 133, 134, 135, 136, 137, 138, 139, 102, 02064 114, 142, 143, 144, 145, 146, 147, 148, 149, 150, 02065 151, 179, 228, 368, 181, 182, 183, 103, 49, 50, 02066 51, 189, 88, 89, 24, 111, 194, 195, 10, 11, 02067 12, 13, 14, 15, 16, 17, 27, 28, 206, 4, 02068 109, 3, 4, 211, 185, 3, 4, 3, 4, 3, 02069 4, 3, 4, 102, 222, 223, 224, 207, 109, 102, 02070 102, 107, 4, 4, 4, 105, 207, 105, 4, 24, 02071 105, 0, 108, 24, 108, 56, 226, 4, 392, 295, 02072 394, 297, 298, 299, 4, 226, 227, 228, 4, 305, 02073 4, 103, 7, 4, 7, 7, 25, 106, 103, 103, 02074 267, 107, 31, 36, 103, 103, 312, 313, 314, 315, 02075 316, 317, 41, 42, 43, 44, 103, 103, 286, 325, 02076 326, 327, 328, 103, 292, 103, 103, 103, 103, 24, 02077 59, 103, 105, 24, 105, 105, 105, 105, 306, 307, 02078 106, 105, 105, 60, 105, 105, 105, 34, 24, 21, 02079 103, 21, 4, 294, 295, 296, 297, 298, 299, 300, 02080 301, 263, 107, 24, 305, 103, 103, 4, 103, 375, 02081 36, 103, 103, 103, 54, 343, 4, 345, 103, 105, 02082 103, 349, 103, 399, 400, 401, 105, 54, 106, 24, 02083 358, 359, 360, 334, 103, 103, 103, 103, 103, 103, 02084 103, 103, 103, 103, 103, 346, 412, 413, 414, 415, 02085 103, 417, 418, 419, 420, 431, 106, 103, 103, 103, 02086 109, 389, 390, 364, 107, 106, 103, 106, 452, 397, 02087 452, 106, 103, 106, 103, 21, 36, 21, 406, 21, 02088 69, 106, 106, 106, 103, 103, 470, 109, 470, 106, 02089 391, 194, 195, 459, 21, 461, 462, 106, 399, 400, 02090 401, 106, 21, 206, 405, 433, 86, 86, 211, 86, 02091 411, 86, 35, 22, 20, 335, 22, 107, 24, 222, 02092 223, 224, 179, 48, 45, 31, 32, 33, 25, 334, 02093 431, 3, 16, 346, 405, 41, 42, 43, 44, 467, 02094 -1, 47, 48, -1, -1, 369, -1, -1, -1, 55, 02095 -1, -1, 480, 59, -1, -1, -1, -1, -1, 487, 02096 5, 6, -1, 491, 492, -1, -1, -1, -1, -1, 02097 -1, -1, -1, -1, -1, -1, -1, 22, -1, 24, 02098 -1, 26, -1, 286, -1, -1, -1, -1, -1, 292, 02099 -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, 02100 -1, -1, -1, 306, 307, -1, -1, -1, -1, -1, 02101 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02102 -1, -1, -1, -1, -1, -1, 71, 72, 73, 74, 02103 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 02104 343, -1, 345, -1, -1, 90, 349, 92, 93, 94, 02105 95, -1, 97, 98, 99, 358, 359, 360, -1, -1, 02106 -1, -1, 107, -1, -1, 110, -1, 112, -1, -1, 02107 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02108 -1, -1, -1, -1, -1, -1, 389, 390, -1, -1, 02109 -1, -1, -1, -1, 397, -1, -1, -1, -1, -1, 02110 -1, 5, 6, 406, 8, 9, 10, 11, 12, 13, 02111 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 02112 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02113 433, -1, -1, -1, -1, -1, -1, -1, -1, 5, 02114 6, 45, 8, 9, 10, 11, 12, 13, 14, 15, 02115 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, 02116 -1, -1, -1, -1, 467, -1, -1, -1, -1, -1, 02117 -1, -1, -1, -1, -1, -1, -1, 480, -1, 45, 02118 -1, -1, -1, -1, 487, -1, -1, -1, 491, 492, 02119 -1, -1, -1, 3, 4, 5, 6, 7, -1, -1, 02120 104, -1, -1, 107, -1, -1, 110, -1, 112, 113, 02121 -1, -1, 22, -1, 24, -1, 26, 27, 28, -1, 02122 -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, 02123 -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, 02124 -1, 107, -1, -1, 110, -1, 112, 113, 58, -1, 02125 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02126 -1, 71, 72, 73, 74, 75, 76, 77, 78, 79, 02127 80, 81, 82, 83, 84, -1, -1, -1, -1, -1, 02128 90, -1, 92, 93, 94, 95, -1, 97, 98, 99, 02129 3, 4, -1, -1, 7, -1, -1, -1, -1, -1, 02130 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02131 -1, -1, -1, 26, 27, 28, -1, -1, -1, -1, 02132 -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, 02133 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02134 -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, 02135 -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, 02136 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 02137 83, 84, -1, -1, -1, -1, -1, 90, -1, 92, 02138 93, 94, 95, -1, 97, 98, 99, -1, -1, -1, 02139 -1, -1, -1, -1, -1, 5, 6, 110, 8, 9, 02140 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 02141 20, 21, 22, -1, 24, -1, -1, -1, -1, -1, 02142 -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, 02143 -1, -1, -1, 5, 6, 45, 8, 9, 10, 11, 02144 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 02145 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, 02146 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, 02147 -1, 5, 6, 45, 8, 9, 10, 11, 12, 13, 02148 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 02149 24, -1, -1, -1, 104, -1, -1, 107, -1, -1, 02150 110, -1, 112, -1, -1, -1, -1, -1, -1, 5, 02151 6, 45, 8, 9, 10, 11, 12, 13, 14, 15, 02152 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, 02153 -1, -1, 104, -1, -1, 107, -1, -1, 110, -1, 02154 112, 37, -1, -1, -1, -1, -1, 5, 6, 45, 02155 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 02156 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, 02157 104, -1, -1, 107, -1, 109, 110, -1, 112, 37, 02158 -1, -1, -1, -1, -1, 5, 6, 45, 8, 9, 02159 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 02160 20, 21, 22, -1, 24, -1, -1, -1, 104, -1, 02161 -1, 107, -1, -1, 110, -1, 112, -1, -1, -1, 02162 -1, -1, -1, 5, 6, 45, 8, 9, 10, 11, 02163 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 02164 22, -1, 24, -1, -1, -1, 104, -1, -1, 107, 02165 -1, -1, 110, -1, 112, -1, -1, -1, -1, -1, 02166 -1, 5, 6, 45, 8, 9, 10, 11, 12, 13, 02167 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 02168 24, -1, -1, -1, 104, -1, -1, 107, -1, -1, 02169 110, -1, 112, -1, -1, -1, -1, -1, -1, 5, 02170 6, 45, 8, 9, 10, 11, 12, 13, 14, 15, 02171 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, 02172 -1, -1, 104, -1, -1, 107, -1, -1, 110, -1, 02173 112, -1, -1, -1, -1, -1, -1, -1, -1, 45, 02174 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02175 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02176 104, -1, -1, 107, -1, -1, 110, -1, 112, -1, 02177 -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, 02178 -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, 02179 -1, -1, -1, -1, -1, -1, -1, -1, 104, 56, 02180 57, 107, -1, -1, 110, -1, 112, -1, 65, 66, 02181 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 02182 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 02183 87, -1, -1, 90, 91, 92, 93, 94, 95, 96, 02184 97, 98, 99, 100, 101 02185 }; 02186 02187 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 02188 symbol of state STATE-NUM. */ 02189 static const yytype_uint8 yystos[] = 02190 { 02191 0, 147, 148, 149, 0, 25, 31, 41, 42, 43, 02192 44, 59, 128, 164, 166, 167, 174, 22, 24, 48, 02193 55, 59, 127, 157, 167, 168, 58, 61, 62, 63, 02194 64, 129, 162, 23, 175, 176, 30, 113, 165, 175, 02195 49, 50, 51, 154, 102, 58, 20, 47, 128, 102, 02196 162, 24, 152, 4, 5, 6, 8, 9, 10, 11, 02197 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 02198 45, 104, 107, 110, 112, 117, 136, 137, 138, 139, 02199 140, 157, 171, 29, 112, 163, 127, 179, 102, 102, 02200 102, 107, 155, 152, 136, 32, 33, 146, 146, 4, 02201 4, 4, 8, 113, 140, 141, 157, 105, 114, 35, 02202 46, 56, 57, 65, 66, 67, 68, 69, 70, 71, 02203 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 02204 82, 83, 84, 85, 86, 87, 90, 91, 92, 93, 02205 94, 95, 96, 97, 98, 99, 100, 101, 119, 120, 02206 121, 122, 177, 183, 184, 186, 187, 24, 52, 53, 02207 153, 4, 24, 156, 138, 9, 10, 11, 12, 13, 02208 14, 15, 16, 17, 18, 19, 123, 124, 126, 138, 02209 143, 108, 108, 103, 113, 105, 37, 141, 142, 138, 02210 173, 56, 8, 173, 9, 21, 10, 11, 12, 13, 02211 14, 15, 16, 17, 123, 124, 125, 129, 138, 138, 02212 173, 138, 138, 180, 173, 173, 173, 173, 173, 173, 02213 173, 173, 138, 138, 138, 173, 129, 88, 89, 103, 02214 109, 151, 27, 28, 3, 4, 118, 4, 7, 26, 02215 38, 39, 90, 92, 93, 97, 98, 99, 107, 110, 02216 112, 115, 119, 120, 121, 122, 144, 171, 150, 140, 02217 140, 140, 37, 138, 159, 160, 161, 103, 106, 3, 02218 4, 7, 26, 27, 28, 38, 39, 58, 110, 144, 02219 170, 171, 172, 172, 172, 172, 136, 103, 131, 103, 02220 131, 172, 107, 103, 36, 103, 103, 103, 103, 103, 02221 103, 103, 172, 172, 172, 103, 136, 138, 173, 24, 02222 103, 134, 105, 105, 105, 105, 105, 105, 109, 143, 02223 145, 145, 113, 145, 24, 105, 105, 105, 105, 134, 02224 109, 111, 157, 158, 103, 106, 37, 60, 169, 145, 02225 103, 103, 172, 15, 54, 15, 103, 185, 172, 107, 02226 138, 173, 138, 173, 173, 173, 138, 138, 103, 103, 02227 103, 173, 172, 172, 103, 34, 54, 132, 135, 143, 02228 143, 143, 143, 143, 143, 103, 109, 111, 113, 143, 02229 143, 143, 143, 37, 159, 132, 133, 24, 111, 21, 02230 21, 105, 172, 4, 172, 173, 181, 103, 172, 103, 02231 103, 103, 172, 172, 172, 105, 138, 24, 4, 134, 02232 185, 36, 103, 103, 103, 103, 143, 103, 103, 103, 02233 103, 54, 130, 103, 172, 172, 181, 182, 103, 131, 02234 131, 103, 172, 103, 173, 173, 173, 182, 172, 106, 02235 138, 143, 143, 143, 143, 143, 143, 143, 143, 4, 02236 24, 103, 107, 106, 173, 109, 172, 106, 106, 103, 02237 106, 103, 103, 106, 106, 106, 106, 21, 109, 125, 02238 178, 36, 109, 143, 143, 143, 172, 170, 109, 125, 02239 21, 106, 106, 106, 103, 170, 172, 21, 103, 69, 02240 172, 21, 21, 172, 172 02241 }; 02242 02243 #define yyerrok (yyerrstatus = 0) 02244 #define yyclearin (yychar = YYEMPTY) 02245 #define YYEMPTY (-2) 02246 #define YYEOF 0 02247 02248 #define YYACCEPT goto yyacceptlab 02249 #define YYABORT goto yyabortlab 02250 #define YYERROR goto yyerrorlab 02251 02252 02253 /* Like YYERROR except do call yyerror. This remains here temporarily 02254 to ease the transition to the new meaning of YYERROR, for GCC. 02255 Once GCC version 2 has supplanted version 1, this can go. */ 02256 02257 #define YYFAIL goto yyerrlab 02258 02259 #define YYRECOVERING() (!!yyerrstatus) 02260 02261 #define YYBACKUP(Token, Value) \ 02262 do \ 02263 if (yychar == YYEMPTY && yylen == 1) \ 02264 { \ 02265 yychar = (Token); \ 02266 yylval = (Value); \ 02267 yytoken = YYTRANSLATE (yychar); \ 02268 YYPOPSTACK (1); \ 02269 goto yybackup; \ 02270 } \ 02271 else \ 02272 { \ 02273 yyerror (YY_("syntax error: cannot back up")); \ 02274 YYERROR; \ 02275 } \ 02276 while (YYID (0)) 02277 02278 02279 #define YYTERROR 1 02280 #define YYERRCODE 256 02281 02282 02283 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 02284 If N is 0, then set CURRENT to the empty location which ends 02285 the previous symbol: RHS[0] (always defined). */ 02286 02287 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 02288 #ifndef YYLLOC_DEFAULT 02289 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 02290 do \ 02291 if (YYID (N)) \ 02292 { \ 02293 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 02294 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 02295 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 02296 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 02297 } \ 02298 else \ 02299 { \ 02300 (Current).first_line = (Current).last_line = \ 02301 YYRHSLOC (Rhs, 0).last_line; \ 02302 (Current).first_column = (Current).last_column = \ 02303 YYRHSLOC (Rhs, 0).last_column; \ 02304 } \ 02305 while (YYID (0)) 02306 #endif 02307 02308 02309 /* YY_LOCATION_PRINT -- Print the location on the stream. 02310 This macro was not mandated originally: define only if we know 02311 we won't break user code: when these are the locations we know. */ 02312 02313 #ifndef YY_LOCATION_PRINT 02314 # if YYLTYPE_IS_TRIVIAL 02315 # define YY_LOCATION_PRINT(File, Loc) \ 02316 fprintf (File, "%d.%d-%d.%d", \ 02317 (Loc).first_line, (Loc).first_column, \ 02318 (Loc).last_line, (Loc).last_column) 02319 # else 02320 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 02321 # endif 02322 #endif 02323 02324 02325 /* YYLEX -- calling `yylex' with the right arguments. */ 02326 02327 #ifdef YYLEX_PARAM 02328 # define YYLEX yylex (YYLEX_PARAM) 02329 #else 02330 # define YYLEX yylex () 02331 #endif 02332 02333 /* Enable debugging if requested. */ 02334 #if YYDEBUG 02335 02336 # ifndef YYFPRINTF 02337 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 02338 # define YYFPRINTF fprintf 02339 # endif 02340 02341 # define YYDPRINTF(Args) \ 02342 do { \ 02343 if (yydebug) \ 02344 YYFPRINTF Args; \ 02345 } while (YYID (0)) 02346 02347 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 02348 do { \ 02349 if (yydebug) \ 02350 { \ 02351 YYFPRINTF (stderr, "%s ", Title); \ 02352 yy_symbol_print (stderr, \ 02353 Type, Value); \ 02354 YYFPRINTF (stderr, "\n"); \ 02355 } \ 02356 } while (YYID (0)) 02357 02358 02359 /*--------------------------------. 02360 | Print this symbol on YYOUTPUT. | 02361 `--------------------------------*/ 02362 02363 /*ARGSUSED*/ 02364 #if (defined __STDC__ || defined __C99__FUNC__ \ 02365 || defined __cplusplus || defined _MSC_VER) 02366 static void 02367 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 02368 #else 02369 static void 02370 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 02371 FILE *yyoutput; 02372 int yytype; 02373 YYSTYPE const * const yyvaluep; 02374 #endif 02375 { 02376 if (!yyvaluep) 02377 return; 02378 # ifdef YYPRINT 02379 if (yytype < YYNTOKENS) 02380 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 02381 # else 02382 YYUSE (yyoutput); 02383 # endif 02384 switch (yytype) 02385 { 02386 default: 02387 break; 02388 } 02389 } 02390 02391 02392 /*--------------------------------. 02393 | Print this symbol on YYOUTPUT. | 02394 `--------------------------------*/ 02395 02396 #if (defined __STDC__ || defined __C99__FUNC__ \ 02397 || defined __cplusplus || defined _MSC_VER) 02398 static void 02399 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 02400 #else 02401 static void 02402 yy_symbol_print (yyoutput, yytype, yyvaluep) 02403 FILE *yyoutput; 02404 int yytype; 02405 YYSTYPE const * const yyvaluep; 02406 #endif 02407 { 02408 if (yytype < YYNTOKENS) 02409 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 02410 else 02411 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 02412 02413 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 02414 YYFPRINTF (yyoutput, ")"); 02415 } 02416 02417 /*------------------------------------------------------------------. 02418 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 02419 | TOP (included). | 02420 `------------------------------------------------------------------*/ 02421 02422 #if (defined __STDC__ || defined __C99__FUNC__ \ 02423 || defined __cplusplus || defined _MSC_VER) 02424 static void 02425 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) 02426 #else 02427 static void 02428 yy_stack_print (bottom, top) 02429 yytype_int16 *bottom; 02430 yytype_int16 *top; 02431 #endif 02432 { 02433 YYFPRINTF (stderr, "Stack now"); 02434 for (; bottom <= top; ++bottom) 02435 YYFPRINTF (stderr, " %d", *bottom); 02436 YYFPRINTF (stderr, "\n"); 02437 } 02438 02439 # define YY_STACK_PRINT(Bottom, Top) \ 02440 do { \ 02441 if (yydebug) \ 02442 yy_stack_print ((Bottom), (Top)); \ 02443 } while (YYID (0)) 02444 02445 02446 /*------------------------------------------------. 02447 | Report that the YYRULE is going to be reduced. | 02448 `------------------------------------------------*/ 02449 02450 #if (defined __STDC__ || defined __C99__FUNC__ \ 02451 || defined __cplusplus || defined _MSC_VER) 02452 static void 02453 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 02454 #else 02455 static void 02456 yy_reduce_print (yyvsp, yyrule) 02457 YYSTYPE *yyvsp; 02458 int yyrule; 02459 #endif 02460 { 02461 int yynrhs = yyr2[yyrule]; 02462 int yyi; 02463 unsigned long int yylno = yyrline[yyrule]; 02464 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 02465 yyrule - 1, yylno); 02466 /* The symbols being reduced. */ 02467 for (yyi = 0; yyi < yynrhs; yyi++) 02468 { 02469 fprintf (stderr, " $%d = ", yyi + 1); 02470 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 02471 &(yyvsp[(yyi + 1) - (yynrhs)]) 02472 ); 02473 fprintf (stderr, "\n"); 02474 } 02475 } 02476 02477 # define YY_REDUCE_PRINT(Rule) \ 02478 do { \ 02479 if (yydebug) \ 02480 yy_reduce_print (yyvsp, Rule); \ 02481 } while (YYID (0)) 02482 02483 /* Nonzero means print parse trace. It is left uninitialized so that 02484 multiple parsers can coexist. */ 02485 int yydebug; 02486 #else /* !YYDEBUG */ 02487 # define YYDPRINTF(Args) 02488 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 02489 # define YY_STACK_PRINT(Bottom, Top) 02490 # define YY_REDUCE_PRINT(Rule) 02491 #endif /* !YYDEBUG */ 02492 02493 02494 /* YYINITDEPTH -- initial size of the parser's stacks. */ 02495 #ifndef YYINITDEPTH 02496 # define YYINITDEPTH 200 02497 #endif 02498 02499 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 02500 if the built-in stack extension method is used). 02501 02502 Do not make this value too large; the results are undefined if 02503 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 02504 evaluated with infinite-precision integer arithmetic. */ 02505 02506 #ifndef YYMAXDEPTH 02507 # define YYMAXDEPTH 10000 02508 #endif 02509 02510 02511 02512 #if YYERROR_VERBOSE 02513 02514 # ifndef yystrlen 02515 # if defined __GLIBC__ && defined _STRING_H 02516 # define yystrlen strlen 02517 # else 02518 /* Return the length of YYSTR. */ 02519 #if (defined __STDC__ || defined __C99__FUNC__ \ 02520 || defined __cplusplus || defined _MSC_VER) 02521 static YYSIZE_T 02522 yystrlen (const char *yystr) 02523 #else 02524 static YYSIZE_T 02525 yystrlen (yystr) 02526 const char *yystr; 02527 #endif 02528 { 02529 YYSIZE_T yylen; 02530 for (yylen = 0; yystr[yylen]; yylen++) 02531 continue; 02532 return yylen; 02533 } 02534 # endif 02535 # endif 02536 02537 # ifndef yystpcpy 02538 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 02539 # define yystpcpy stpcpy 02540 # else 02541 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 02542 YYDEST. */ 02543 #if (defined __STDC__ || defined __C99__FUNC__ \ 02544 || defined __cplusplus || defined _MSC_VER) 02545 static char * 02546 yystpcpy (char *yydest, const char *yysrc) 02547 #else 02548 static char * 02549 yystpcpy (yydest, yysrc) 02550 char *yydest; 02551 const char *yysrc; 02552 #endif 02553 { 02554 char *yyd = yydest; 02555 const char *yys = yysrc; 02556 02557 while ((*yyd++ = *yys++) != '\0') 02558 continue; 02559 02560 return yyd - 1; 02561 } 02562 # endif 02563 # endif 02564 02565 # ifndef yytnamerr 02566 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 02567 quotes and backslashes, so that it's suitable for yyerror. The 02568 heuristic is that double-quoting is unnecessary unless the string 02569 contains an apostrophe, a comma, or backslash (other than 02570 backslash-backslash). YYSTR is taken from yytname. If YYRES is 02571 null, do not copy; instead, return the length of what the result 02572 would have been. */ 02573 static YYSIZE_T 02574 yytnamerr (char *yyres, const char *yystr) 02575 { 02576 if (*yystr == '"') 02577 { 02578 YYSIZE_T yyn = 0; 02579 char const *yyp = yystr; 02580 02581 for (;;) 02582 switch (*++yyp) 02583 { 02584 case '\'': 02585 case ',': 02586 goto do_not_strip_quotes; 02587 02588 case '\\': 02589 if (*++yyp != '\\') 02590 goto do_not_strip_quotes; 02591 /* Fall through. */ 02592 default: 02593 if (yyres) 02594 yyres[yyn] = *yyp; 02595 yyn++; 02596 break; 02597 02598 case '"': 02599 if (yyres) 02600 yyres[yyn] = '\0'; 02601 return yyn; 02602 } 02603 do_not_strip_quotes: ; 02604 } 02605 02606 if (! yyres) 02607 return yystrlen (yystr); 02608 02609 return yystpcpy (yyres, yystr) - yyres; 02610 } 02611 # endif 02612 02613 /* Copy into YYRESULT an error message about the unexpected token 02614 YYCHAR while in state YYSTATE. Return the number of bytes copied, 02615 including the terminating null byte. If YYRESULT is null, do not 02616 copy anything; just return the number of bytes that would be 02617 copied. As a special case, return 0 if an ordinary "syntax error" 02618 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 02619 size calculation. */ 02620 static YYSIZE_T 02621 yysyntax_error (char *yyresult, int yystate, int yychar) 02622 { 02623 int yyn = yypact[yystate]; 02624 02625 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 02626 return 0; 02627 else 02628 { 02629 int yytype = YYTRANSLATE (yychar); 02630 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 02631 YYSIZE_T yysize = yysize0; 02632 YYSIZE_T yysize1; 02633 int yysize_overflow = 0; 02634 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 02635 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 02636 int yyx; 02637 02638 # if 0 02639 /* This is so xgettext sees the translatable formats that are 02640 constructed on the fly. */ 02641 YY_("syntax error, unexpected %s"); 02642 YY_("syntax error, unexpected %s, expecting %s"); 02643 YY_("syntax error, unexpected %s, expecting %s or %s"); 02644 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 02645 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 02646 # endif 02647 char *yyfmt; 02648 char const *yyf; 02649 static char const yyunexpected[] = "syntax error, unexpected %s"; 02650 static char const yyexpecting[] = ", expecting %s"; 02651 static char const yyor[] = " or %s"; 02652 char yyformat[sizeof yyunexpected 02653 + sizeof yyexpecting - 1 02654 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 02655 * (sizeof yyor - 1))]; 02656 char const *yyprefix = yyexpecting; 02657 02658 /* Start YYX at -YYN if negative to avoid negative indexes in 02659 YYCHECK. */ 02660 int yyxbegin = yyn < 0 ? -yyn : 0; 02661 02662 /* Stay within bounds of both yycheck and yytname. */ 02663 int yychecklim = YYLAST - yyn + 1; 02664 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 02665 int yycount = 1; 02666 02667 yyarg[0] = yytname[yytype]; 02668 yyfmt = yystpcpy (yyformat, yyunexpected); 02669 02670 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 02671 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 02672 { 02673 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 02674 { 02675 yycount = 1; 02676 yysize = yysize0; 02677 yyformat[sizeof yyunexpected - 1] = '\0'; 02678 break; 02679 } 02680 yyarg[yycount++] = yytname[yyx]; 02681 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 02682 yysize_overflow |= (yysize1 < yysize); 02683 yysize = yysize1; 02684 yyfmt = yystpcpy (yyfmt, yyprefix); 02685 yyprefix = yyor; 02686 } 02687 02688 yyf = YY_(yyformat); 02689 yysize1 = yysize + yystrlen (yyf); 02690 yysize_overflow |= (yysize1 < yysize); 02691 yysize = yysize1; 02692 02693 if (yysize_overflow) 02694 return YYSIZE_MAXIMUM; 02695 02696 if (yyresult) 02697 { 02698 /* Avoid sprintf, as that infringes on the user's name space. 02699 Don't have undefined behavior even if the translation 02700 produced a string with the wrong number of "%s"s. */ 02701 char *yyp = yyresult; 02702 int yyi = 0; 02703 while ((*yyp = *yyf) != '\0') 02704 { 02705 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 02706 { 02707 yyp += yytnamerr (yyp, yyarg[yyi++]); 02708 yyf += 2; 02709 } 02710 else 02711 { 02712 yyp++; 02713 yyf++; 02714 } 02715 } 02716 } 02717 return yysize; 02718 } 02719 } 02720 #endif /* YYERROR_VERBOSE */ 02721 02722 02723 /*-----------------------------------------------. 02724 | Release the memory associated to this symbol. | 02725 `-----------------------------------------------*/ 02726 02727 /*ARGSUSED*/ 02728 #if (defined __STDC__ || defined __C99__FUNC__ \ 02729 || defined __cplusplus || defined _MSC_VER) 02730 static void 02731 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 02732 #else 02733 static void 02734 yydestruct (yymsg, yytype, yyvaluep) 02735 const char *yymsg; 02736 int yytype; 02737 YYSTYPE *yyvaluep; 02738 #endif 02739 { 02740 YYUSE (yyvaluep); 02741 02742 if (!yymsg) 02743 yymsg = "Deleting"; 02744 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 02745 02746 switch (yytype) 02747 { 02748 02749 default: 02750 break; 02751 } 02752 } 02753 02754 02755 /* Prevent warnings from -Wmissing-prototypes. */ 02756 02757 #ifdef YYPARSE_PARAM 02758 #if defined __STDC__ || defined __cplusplus 02759 int yyparse (void *YYPARSE_PARAM); 02760 #else 02761 int yyparse (); 02762 #endif 02763 #else /* ! YYPARSE_PARAM */ 02764 #if defined __STDC__ || defined __cplusplus 02765 int yyparse (void); 02766 #else 02767 int yyparse (); 02768 #endif 02769 #endif /* ! YYPARSE_PARAM */ 02770 02771 02772 02773 /* The look-ahead symbol. */ 02774 int yychar; 02775 02776 /* The semantic value of the look-ahead symbol. */ 02777 YYSTYPE yylval; 02778 02779 /* Number of syntax errors so far. */ 02780 int yynerrs; 02781 02782 02783 02784 /*----------. 02785 | yyparse. | 02786 `----------*/ 02787 02788 #ifdef YYPARSE_PARAM 02789 #if (defined __STDC__ || defined __C99__FUNC__ \ 02790 || defined __cplusplus || defined _MSC_VER) 02791 int 02792 yyparse (void *YYPARSE_PARAM) 02793 #else 02794 int 02795 yyparse (YYPARSE_PARAM) 02796 void *YYPARSE_PARAM; 02797 #endif 02798 #else /* ! YYPARSE_PARAM */ 02799 #if (defined __STDC__ || defined __C99__FUNC__ \ 02800 || defined __cplusplus || defined _MSC_VER) 02801 int 02802 yyparse (void) 02803 #else 02804 int 02805 yyparse () 02806 02807 #endif 02808 #endif 02809 { 02810 02811 int yystate; 02812 int yyn; 02813 int yyresult; 02814 /* Number of tokens to shift before error messages enabled. */ 02815 int yyerrstatus; 02816 /* Look-ahead token as an internal (translated) token number. */ 02817 int yytoken = 0; 02818 #if YYERROR_VERBOSE 02819 /* Buffer for error messages, and its allocated size. */ 02820 char yymsgbuf[128]; 02821 char *yymsg = yymsgbuf; 02822 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 02823 #endif 02824 02825 /* Three stacks and their tools: 02826 `yyss': related to states, 02827 `yyvs': related to semantic values, 02828 `yyls': related to locations. 02829 02830 Refer to the stacks thru separate pointers, to allow yyoverflow 02831 to reallocate them elsewhere. */ 02832 02833 /* The state stack. */ 02834 yytype_int16 yyssa[YYINITDEPTH]; 02835 yytype_int16 *yyss = yyssa; 02836 yytype_int16 *yyssp; 02837 02838 /* The semantic value stack. */ 02839 YYSTYPE yyvsa[YYINITDEPTH]; 02840 YYSTYPE *yyvs = yyvsa; 02841 YYSTYPE *yyvsp; 02842 02843 02844 02845 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 02846 02847 YYSIZE_T yystacksize = YYINITDEPTH; 02848 02849 /* The variables used to return semantic value and location from the 02850 action routines. */ 02851 YYSTYPE yyval; 02852 02853 02854 /* The number of symbols on the RHS of the reduced rule. 02855 Keep to zero when no symbol should be popped. */ 02856 int yylen = 0; 02857 02858 YYDPRINTF ((stderr, "Starting parse\n")); 02859 02860 yystate = 0; 02861 yyerrstatus = 0; 02862 yynerrs = 0; 02863 yychar = YYEMPTY; /* Cause a token to be read. */ 02864 02865 /* Initialize stack pointers. 02866 Waste one element of value and location stack 02867 so that they stay on the same level as the state stack. 02868 The wasted elements are never initialized. */ 02869 02870 yyssp = yyss; 02871 yyvsp = yyvs; 02872 02873 goto yysetstate; 02874 02875 /*------------------------------------------------------------. 02876 | yynewstate -- Push a new state, which is found in yystate. | 02877 `------------------------------------------------------------*/ 02878 yynewstate: 02879 /* In all cases, when you get here, the value and location stacks 02880 have just been pushed. So pushing a state here evens the stacks. */ 02881 yyssp++; 02882 02883 yysetstate: 02884 *yyssp = yystate; 02885 02886 if (yyss + yystacksize - 1 <= yyssp) 02887 { 02888 /* Get the current used size of the three stacks, in elements. */ 02889 YYSIZE_T yysize = yyssp - yyss + 1; 02890 02891 #ifdef yyoverflow 02892 { 02893 /* Give user a chance to reallocate the stack. Use copies of 02894 these so that the &'s don't force the real ones into 02895 memory. */ 02896 YYSTYPE *yyvs1 = yyvs; 02897 yytype_int16 *yyss1 = yyss; 02898 02899 02900 /* Each stack pointer address is followed by the size of the 02901 data in use in that stack, in bytes. This used to be a 02902 conditional around just the two extra args, but that might 02903 be undefined if yyoverflow is a macro. */ 02904 yyoverflow (YY_("memory exhausted"), 02905 &yyss1, yysize * sizeof (*yyssp), 02906 &yyvs1, yysize * sizeof (*yyvsp), 02907 02908 &yystacksize); 02909 02910 yyss = yyss1; 02911 yyvs = yyvs1; 02912 } 02913 #else /* no yyoverflow */ 02914 # ifndef YYSTACK_RELOCATE 02915 goto yyexhaustedlab; 02916 # else 02917 /* Extend the stack our own way. */ 02918 if (YYMAXDEPTH <= yystacksize) 02919 goto yyexhaustedlab; 02920 yystacksize *= 2; 02921 if (YYMAXDEPTH < yystacksize) 02922 yystacksize = YYMAXDEPTH; 02923 02924 { 02925 yytype_int16 *yyss1 = yyss; 02926 union yyalloc *yyptr = 02927 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 02928 if (! yyptr) 02929 goto yyexhaustedlab; 02930 YYSTACK_RELOCATE (yyss); 02931 YYSTACK_RELOCATE (yyvs); 02932 02933 # undef YYSTACK_RELOCATE 02934 if (yyss1 != yyssa) 02935 YYSTACK_FREE (yyss1); 02936 } 02937 # endif 02938 #endif /* no yyoverflow */ 02939 02940 yyssp = yyss + yysize - 1; 02941 yyvsp = yyvs + yysize - 1; 02942 02943 02944 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 02945 (unsigned long int) yystacksize)); 02946 02947 if (yyss + yystacksize - 1 <= yyssp) 02948 YYABORT; 02949 } 02950 02951 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 02952 02953 goto yybackup; 02954 02955 /*-----------. 02956 | yybackup. | 02957 `-----------*/ 02958 yybackup: 02959 02960 /* Do appropriate processing given the current state. Read a 02961 look-ahead token if we need one and don't already have one. */ 02962 02963 /* First try to decide what to do without reference to look-ahead token. */ 02964 yyn = yypact[yystate]; 02965 if (yyn == YYPACT_NINF) 02966 goto yydefault; 02967 02968 /* Not known => get a look-ahead token if don't already have one. */ 02969 02970 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 02971 if (yychar == YYEMPTY) 02972 { 02973 YYDPRINTF ((stderr, "Reading a token: ")); 02974 yychar = YYLEX; 02975 } 02976 02977 if (yychar <= YYEOF) 02978 { 02979 yychar = yytoken = YYEOF; 02980 YYDPRINTF ((stderr, "Now at end of input.\n")); 02981 } 02982 else 02983 { 02984 yytoken = YYTRANSLATE (yychar); 02985 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 02986 } 02987 02988 /* If the proper action on seeing token YYTOKEN is to reduce or to 02989 detect an error, take that action. */ 02990 yyn += yytoken; 02991 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 02992 goto yydefault; 02993 yyn = yytable[yyn]; 02994 if (yyn <= 0) 02995 { 02996 if (yyn == 0 || yyn == YYTABLE_NINF) 02997 goto yyerrlab; 02998 yyn = -yyn; 02999 goto yyreduce; 03000 } 03001 03002 if (yyn == YYFINAL) 03003 YYACCEPT; 03004 03005 /* Count tokens shifted since error; after three, turn off error 03006 status. */ 03007 if (yyerrstatus) 03008 yyerrstatus--; 03009 03010 /* Shift the look-ahead token. */ 03011 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 03012 03013 /* Discard the shifted token unless it is eof. */ 03014 if (yychar != YYEOF) 03015 yychar = YYEMPTY; 03016 03017 yystate = yyn; 03018 *++yyvsp = yylval; 03019 03020 goto yynewstate; 03021 03022 03023 /*-----------------------------------------------------------. 03024 | yydefault -- do the default action for the current state. | 03025 `-----------------------------------------------------------*/ 03026 yydefault: 03027 yyn = yydefact[yystate]; 03028 if (yyn == 0) 03029 goto yyerrlab; 03030 goto yyreduce; 03031 03032 03033 /*-----------------------------. 03034 | yyreduce -- Do a reduction. | 03035 `-----------------------------*/ 03036 yyreduce: 03037 /* yyn is the number of a rule to reduce with. */ 03038 yylen = yyr2[yyn]; 03039 03040 /* If YYLEN is nonzero, implement the default value of the action: 03041 `$$ = $1'. 03042 03043 Otherwise, the following line sets YYVAL to garbage. 03044 This behavior is undocumented and Bison 03045 users should not rely upon it. Assigning to YYVAL 03046 unconditionally makes the parser a bit smaller, and it avoids a 03047 GCC warning that YYVAL may be used uninitialized. */ 03048 yyval = yyvsp[1-yylen]; 03049 03050 03051 YY_REDUCE_PRINT (yyn); 03052 switch (yyn) 03053 { 03054 case 3: 03055 #line 1011 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03056 { 03057 if ((yyvsp[(1) - (1)].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! 03058 ThrowException("Value too large for type!"); 03059 (yyval.SIntVal) = (int32_t)(yyvsp[(1) - (1)].UIntVal); 03060 ;} 03061 break; 03062 03063 case 5: 03064 #line 1019 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03065 { 03066 if ((yyvsp[(1) - (1)].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! 03067 ThrowException("Value too large for type!"); 03068 (yyval.SInt64Val) = (int64_t)(yyvsp[(1) - (1)].UInt64Val); 03069 ;} 03070 break; 03071 03072 case 34: 03073 #line 1042 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03074 { 03075 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); 03076 ;} 03077 break; 03078 03079 case 35: 03080 #line 1045 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03081 { 03082 (yyval.StrVal) = 0; 03083 ;} 03084 break; 03085 03086 case 36: 03087 #line 1049 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03088 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} 03089 break; 03090 03091 case 37: 03092 #line 1050 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03093 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} 03094 break; 03095 03096 case 38: 03097 #line 1051 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03098 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} 03099 break; 03100 03101 case 39: 03102 #line 1052 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03103 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} 03104 break; 03105 03106 case 40: 03107 #line 1053 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03108 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} 03109 break; 03110 03111 case 41: 03112 #line 1055 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03113 { (yyval.UIntVal) = CallingConv::C; ;} 03114 break; 03115 03116 case 42: 03117 #line 1056 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03118 { (yyval.UIntVal) = CallingConv::C; ;} 03119 break; 03120 03121 case 43: 03122 #line 1057 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03123 { (yyval.UIntVal) = CallingConv::Fast; ;} 03124 break; 03125 03126 case 44: 03127 #line 1058 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03128 { (yyval.UIntVal) = CallingConv::Cold; ;} 03129 break; 03130 03131 case 45: 03132 #line 1059 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03133 { 03134 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) 03135 ThrowException("Calling conv too large!"); 03136 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); 03137 ;} 03138 break; 03139 03140 case 46: 03141 #line 1067 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03142 { (yyval.UIntVal) = 0; ;} 03143 break; 03144 03145 case 47: 03146 #line 1068 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03147 { 03148 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); 03149 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) 03150 ThrowException("Alignment must be a power of two!"); 03151 ;} 03152 break; 03153 03154 case 48: 03155 #line 1073 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03156 { (yyval.UIntVal) = 0; ;} 03157 break; 03158 03159 case 49: 03160 #line 1074 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03161 { 03162 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); 03163 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) 03164 ThrowException("Alignment must be a power of two!"); 03165 ;} 03166 break; 03167 03168 case 50: 03169 #line 1081 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03170 { 03171 for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i) 03172 if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\') 03173 ThrowException("Invalid character in section name!"); 03174 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); 03175 ;} 03176 break; 03177 03178 case 51: 03179 #line 1088 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03180 { (yyval.StrVal) = 0; ;} 03181 break; 03182 03183 case 52: 03184 #line 1089 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03185 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} 03186 break; 03187 03188 case 53: 03189 #line 1094 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03190 {;} 03191 break; 03192 03193 case 54: 03194 #line 1095 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03195 {;} 03196 break; 03197 03198 case 55: 03199 #line 1096 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03200 { 03201 CurGV->setSection((yyvsp[(1) - (1)].StrVal)); 03202 free((yyvsp[(1) - (1)].StrVal)); 03203 ;} 03204 break; 03205 03206 case 56: 03207 #line 1100 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03208 { 03209 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) 03210 ThrowException("Alignment must be a power of two!"); 03211 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); 03212 ;} 03213 break; 03214 03215 case 58: 03216 #line 1113 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03217 { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} 03218 break; 03219 03220 case 60: 03221 #line 1114 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03222 { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} 03223 break; 03224 03225 case 61: 03226 #line 1116 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03227 { 03228 if (!UpRefs.empty()) 03229 ThrowException("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); 03230 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); 03231 ;} 03232 break; 03233 03234 case 75: 03235 #line 1127 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03236 { 03237 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); 03238 ;} 03239 break; 03240 03241 case 76: 03242 #line 1130 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03243 { 03244 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); 03245 ;} 03246 break; 03247 03248 case 77: 03249 #line 1133 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03250 { // Named types are also simple types... 03251 (yyval.TypeVal) = new PATypeHolder(getTypeVal((yyvsp[(1) - (1)].ValIDVal))); 03252 ;} 03253 break; 03254 03255 case 78: 03256 #line 1139 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03257 { // Type UpReference 03258 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) ThrowException("Value out of range!"); 03259 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder 03260 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... 03261 (yyval.TypeVal) = new PATypeHolder(OT); 03262 UR_OUT("New Upreference!\n"); 03263 ;} 03264 break; 03265 03266 case 79: 03267 #line 1146 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03268 { // Function derived type? 03269 std::vector<const Type*> Params; 03270 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (4)].TypeList)->begin(), 03271 E = (yyvsp[(3) - (4)].TypeList)->end(); I != E; ++I) 03272 Params.push_back(*I); 03273 bool isVarArg = Params.size() && Params.back() == Type::VoidTy; 03274 if (isVarArg) Params.pop_back(); 03275 03276 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[(1) - (4)].TypeVal),Params,isVarArg))); 03277 delete (yyvsp[(3) - (4)].TypeList); // Delete the argument list 03278 delete (yyvsp[(1) - (4)].TypeVal); // Delete the return type handle 03279 ;} 03280 break; 03281 03282 case 80: 03283 #line 1158 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03284 { // Sized array type? 03285 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); 03286 delete (yyvsp[(4) - (5)].TypeVal); 03287 ;} 03288 break; 03289 03290 case 81: 03291 #line 1162 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03292 { // Packed array type? 03293 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); 03294 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) 03295 ThrowException("Unsigned result not equal to signed result"); 03296 if (!ElemTy->isPrimitiveType()) 03297 ThrowException("Elemental type of a PackedType must be primitive"); 03298 if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val))) 03299 ThrowException("Vector length should be a power of 2!"); 03300 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); 03301 delete (yyvsp[(4) - (5)].TypeVal); 03302 ;} 03303 break; 03304 03305 case 82: 03306 #line 1173 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03307 { // Structure type? 03308 std::vector<const Type*> Elements; 03309 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), 03310 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) 03311 Elements.push_back(*I); 03312 03313 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); 03314 delete (yyvsp[(2) - (3)].TypeList); 03315 ;} 03316 break; 03317 03318 case 83: 03319 #line 1182 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03320 { // Empty structure type? 03321 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); 03322 ;} 03323 break; 03324 03325 case 84: 03326 #line 1185 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03327 { // Pointer type? 03328 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal)))); 03329 delete (yyvsp[(1) - (2)].TypeVal); 03330 ;} 03331 break; 03332 03333 case 85: 03334 #line 1193 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03335 { 03336 (yyval.TypeList) = new std::list<PATypeHolder>(); 03337 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); delete (yyvsp[(1) - (1)].TypeVal); 03338 ;} 03339 break; 03340 03341 case 86: 03342 #line 1197 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03343 { 03344 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); 03345 ;} 03346 break; 03347 03348 case 88: 03349 #line 1203 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03350 { 03351 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(Type::VoidTy); 03352 ;} 03353 break; 03354 03355 case 89: 03356 #line 1206 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03357 { 03358 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy); 03359 ;} 03360 break; 03361 03362 case 90: 03363 #line 1209 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03364 { 03365 (yyval.TypeList) = new std::list<PATypeHolder>(); 03366 ;} 03367 break; 03368 03369 case 91: 03370 #line 1219 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03371 { // Nonempty unsized arr 03372 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); 03373 if (ATy == 0) 03374 ThrowException("Cannot make array constant with type: '" + 03375 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); 03376 const Type *ETy = ATy->getElementType(); 03377 int NumElements = ATy->getNumElements(); 03378 03379 // Verify that we have the correct size... 03380 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) 03381 ThrowException("Type mismatch: constant sized array initialized with " + 03382 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + 03383 itostr(NumElements) + "!"); 03384 03385 // Verify all elements are correct type! 03386 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { 03387 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) 03388 ThrowException("Element #" + utostr(i) + " is not of type '" + 03389 ETy->getDescription() +"' as required!\nIt is of type '"+ 03390 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); 03391 } 03392 03393 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); 03394 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); 03395 ;} 03396 break; 03397 03398 case 92: 03399 #line 1244 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03400 { 03401 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); 03402 if (ATy == 0) 03403 ThrowException("Cannot make array constant with type: '" + 03404 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); 03405 03406 int NumElements = ATy->getNumElements(); 03407 if (NumElements != -1 && NumElements != 0) 03408 ThrowException("Type mismatch: constant sized array initialized with 0" 03409 " arguments, but has size of " + itostr(NumElements) +"!"); 03410 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); 03411 delete (yyvsp[(1) - (3)].TypeVal); 03412 ;} 03413 break; 03414 03415 case 93: 03416 #line 1257 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03417 { 03418 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); 03419 if (ATy == 0) 03420 ThrowException("Cannot make array constant with type: '" + 03421 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); 03422 03423 int NumElements = ATy->getNumElements(); 03424 const Type *ETy = ATy->getElementType(); 03425 char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true); 03426 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal))) 03427 ThrowException("Can't build string constant of size " + 03428 itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) + 03429 " when array has size " + itostr(NumElements) + "!"); 03430 std::vector<Constant*> Vals; 03431 if (ETy == Type::SByteTy) { 03432 for (signed char *C = (signed char *)(yyvsp[(3) - (3)].StrVal); C != (signed char *)EndStr; ++C) 03433 Vals.push_back(ConstantSInt::get(ETy, *C)); 03434 } else if (ETy == Type::UByteTy) { 03435 for (unsigned char *C = (unsigned char *)(yyvsp[(3) - (3)].StrVal); 03436 C != (unsigned char*)EndStr; ++C) 03437 Vals.push_back(ConstantUInt::get(ETy, *C)); 03438 } else { 03439 free((yyvsp[(3) - (3)].StrVal)); 03440 ThrowException("Cannot build string arrays of non byte sized elements!"); 03441 } 03442 free((yyvsp[(3) - (3)].StrVal)); 03443 (yyval.ConstVal) = ConstantArray::get(ATy, Vals); 03444 delete (yyvsp[(1) - (3)].TypeVal); 03445 ;} 03446 break; 03447 03448 case 94: 03449 #line 1286 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03450 { // Nonempty unsized arr 03451 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[(1) - (4)].TypeVal)->get()); 03452 if (PTy == 0) 03453 ThrowException("Cannot make packed constant with type: '" + 03454 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); 03455 const Type *ETy = PTy->getElementType(); 03456 int NumElements = PTy->getNumElements(); 03457 03458 // Verify that we have the correct size... 03459 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) 03460 ThrowException("Type mismatch: constant sized packed initialized with " + 03461 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + 03462 itostr(NumElements) + "!"); 03463 03464 // Verify all elements are correct type! 03465 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { 03466 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) 03467 ThrowException("Element #" + utostr(i) + " is not of type '" + 03468 ETy->getDescription() +"' as required!\nIt is of type '"+ 03469 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); 03470 } 03471 03472 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); 03473 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); 03474 ;} 03475 break; 03476 03477 case 95: 03478 #line 1311 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03479 { 03480 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); 03481 if (STy == 0) 03482 ThrowException("Cannot make struct constant with type: '" + 03483 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); 03484 03485 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) 03486 ThrowException("Illegal number of initializers for structure type!"); 03487 03488 // Check to ensure that constants are compatible with the type initializer! 03489 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) 03490 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) 03491 ThrowException("Expected type '" + 03492 STy->getElementType(i)->getDescription() + 03493 "' for element #" + utostr(i) + 03494 " of structure initializer!"); 03495 03496 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); 03497 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); 03498 ;} 03499 break; 03500 03501 case 96: 03502 #line 1331 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03503 { 03504 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); 03505 if (STy == 0) 03506 ThrowException("Cannot make struct constant with type: '" + 03507 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); 03508 03509 if (STy->getNumContainedTypes() != 0) 03510 ThrowException("Illegal number of initializers for structure type!"); 03511 03512 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); 03513 delete (yyvsp[(1) - (3)].TypeVal); 03514 ;} 03515 break; 03516 03517 case 97: 03518 #line 1343 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03519 { 03520 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); 03521 if (PTy == 0) 03522 ThrowException("Cannot make null pointer constant with type: '" + 03523 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'!"); 03524 03525 (yyval.ConstVal) = ConstantPointerNull::get(PTy); 03526 delete (yyvsp[(1) - (2)].TypeVal); 03527 ;} 03528 break; 03529 03530 case 98: 03531 #line 1352 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03532 { 03533 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); 03534 delete (yyvsp[(1) - (2)].TypeVal); 03535 ;} 03536 break; 03537 03538 case 99: 03539 #line 1356 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03540 { 03541 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); 03542 if (Ty == 0) 03543 ThrowException("Global const reference must be a pointer type!"); 03544 03545 // ConstExprs can exist in the body of a function, thus creating 03546 // GlobalValues whenever they refer to a variable. Because we are in 03547 // the context of a function, getValNonImprovising will search the functions 03548 // symbol table instead of the module symbol table for the global symbol, 03549 // which throws things all off. To get around this, we just tell 03550 // getValNonImprovising that we are at global scope here. 03551 // 03552 Function *SavedCurFn = CurFun.CurrentFunction; 03553 CurFun.CurrentFunction = 0; 03554 03555 Value *V = getValNonImprovising(Ty, (yyvsp[(2) - (2)].ValIDVal)); 03556 03557 CurFun.CurrentFunction = SavedCurFn; 03558 03559 // If this is an initializer for a constant pointer, which is referencing a 03560 // (currently) undefined variable, create a stub now that shall be replaced 03561 // in the future with the right type of variable. 03562 // 03563 if (V == 0) { 03564 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); 03565 const PointerType *PT = cast<PointerType>(Ty); 03566 03567 // First check to see if the forward references value is already created! 03568 PerModuleInfo::GlobalRefsType::iterator I = 03569 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); 03570 03571 if (I != CurModule.GlobalRefs.end()) { 03572 V = I->second; // Placeholder already exists, use it... 03573 (yyvsp[(2) - (2)].ValIDVal).destroy(); 03574 } else { 03575 std::string Name; 03576 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[(2) - (2)].ValIDVal).Name; 03577 03578 // Create the forward referenced global. 03579 GlobalValue *GV; 03580 if (const FunctionType *FTy = 03581 dyn_cast<FunctionType>(PT->getElementType())) { 03582 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, 03583 CurModule.CurrentModule); 03584 } else { 03585 GV = new GlobalVariable(PT->getElementType(), false, 03586 GlobalValue::ExternalLinkage, 0, 03587 Name, CurModule.CurrentModule); 03588 } 03589 03590 // Keep track of the fact that we have a forward ref to recycle it 03591 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV)); 03592 V = GV; 03593 } 03594 } 03595 03596 (yyval.ConstVal) = cast<GlobalValue>(V); 03597 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle 03598 ;} 03599 break; 03600 03601 case 100: 03602 #line 1415 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03603 { 03604 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) 03605 ThrowException("Mismatched types for constant expression!"); 03606 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); 03607 delete (yyvsp[(1) - (2)].TypeVal); 03608 ;} 03609 break; 03610 03611 case 101: 03612 #line 1421 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03613 { 03614 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); 03615 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) 03616 ThrowException("Cannot create a null initialized value of this type!"); 03617 (yyval.ConstVal) = Constant::getNullValue(Ty); 03618 delete (yyvsp[(1) - (2)].TypeVal); 03619 ;} 03620 break; 03621 03622 case 102: 03623 #line 1429 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03624 { // integral constants 03625 if (!ConstantSInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) 03626 ThrowException("Constant value doesn't fit in type!"); 03627 (yyval.ConstVal) = ConstantSInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)); 03628 ;} 03629 break; 03630 03631 case 103: 03632 #line 1434 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03633 { // integral constants 03634 if (!ConstantUInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) 03635 ThrowException("Constant value doesn't fit in type!"); 03636 (yyval.ConstVal) = ConstantUInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)); 03637 ;} 03638 break; 03639 03640 case 104: 03641 #line 1439 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03642 { // Boolean constants 03643 (yyval.ConstVal) = ConstantBool::True; 03644 ;} 03645 break; 03646 03647 case 105: 03648 #line 1442 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03649 { // Boolean constants 03650 (yyval.ConstVal) = ConstantBool::False; 03651 ;} 03652 break; 03653 03654 case 106: 03655 #line 1445 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03656 { // Float & Double constants 03657 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal))) 03658 ThrowException("Floating point constant invalid for type!!"); 03659 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal)); 03660 ;} 03661 break; 03662 03663 case 107: 03664 #line 1452 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03665 { 03666 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isFirstClassType()) 03667 ThrowException("cast constant expression from a non-primitive type: '" + 03668 (yyvsp[(3) - (6)].ConstVal)->getType()->getDescription() + "'!"); 03669 if (!(yyvsp[(5) - (6)].TypeVal)->get()->isFirstClassType()) 03670 ThrowException("cast constant expression to a non-primitive type: '" + 03671 (yyvsp[(5) - (6)].TypeVal)->get()->getDescription() + "'!"); 03672 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].TypeVal)->get()); 03673 delete (yyvsp[(5) - (6)].TypeVal); 03674 ;} 03675 break; 03676 03677 case 108: 03678 #line 1462 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03679 { 03680 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) 03681 ThrowException("GetElementPtr requires a pointer operand!"); 03682 03683 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct 03684 // indices to uint struct indices for compatibility. 03685 generic_gep_type_iterator<std::vector<Value*>::iterator> 03686 GTI = gep_type_begin((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end()), 03687 GTE = gep_type_end((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end()); 03688 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) 03689 if (isa<StructType>(*GTI)) // Only change struct indices 03690 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[(4) - (5)].ValueList))[i])) 03691 if (CUI->getType() == Type::UByteTy) 03692 (*(yyvsp[(4) - (5)].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); 03693 03694 const Type *IdxTy = 03695 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), *(yyvsp[(4) - (5)].ValueList), true); 03696 if (!IdxTy) 03697 ThrowException("Index list invalid for constant getelementptr!"); 03698 03699 std::vector<Constant*> IdxVec; 03700 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) 03701 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) 03702 IdxVec.push_back(C); 03703 else 03704 ThrowException("Indices to constant getelementptr must be constants!"); 03705 03706 delete (yyvsp[(4) - (5)].ValueList); 03707 03708 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), IdxVec); 03709 ;} 03710 break; 03711 03712 case 109: 03713 #line 1493 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03714 { 03715 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::BoolTy) 03716 ThrowException("Select condition must be of boolean type!"); 03717 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) 03718 ThrowException("Select operand types must match!"); 03719 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); 03720 ;} 03721 break; 03722 03723 case 110: 03724 #line 1500 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03725 { 03726 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) 03727 ThrowException("Binary operator types must match!"); 03728 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. 03729 // To retain backward compatibility with these early compilers, we emit a 03730 // cast to the appropriate integer type automatically if we are in the 03731 // broken case. See PR424 for more information. 03732 if (!isa<PointerType>((yyvsp[(3) - (6)].ConstVal)->getType())) { 03733 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); 03734 } else { 03735 const Type *IntPtrTy = 0; 03736 switch (CurModule.CurrentModule->getPointerSize()) { 03737 case Module::Pointer32: IntPtrTy = Type::IntTy; break; 03738 case Module::Pointer64: IntPtrTy = Type::LongTy; break; 03739 default: ThrowException("invalid pointer binary constant expr!"); 03740 } 03741 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), ConstantExpr::getCast((yyvsp[(3) - (6)].ConstVal), IntPtrTy), 03742 ConstantExpr::getCast((yyvsp[(5) - (6)].ConstVal), IntPtrTy)); 03743 (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[(3) - (6)].ConstVal)->getType()); 03744 } 03745 ;} 03746 break; 03747 03748 case 111: 03749 #line 1521 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03750 { 03751 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) 03752 ThrowException("Logical operator types must match!"); 03753 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isIntegral()) { 03754 if (!isa<PackedType>((yyvsp[(3) - (6)].ConstVal)->getType()) || 03755 !cast<PackedType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isIntegral()) 03756 ThrowException("Logical operator requires integral operands!"); 03757 } 03758 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); 03759 ;} 03760 break; 03761 03762 case 112: 03763 #line 1531 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03764 { 03765 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) 03766 ThrowException("setcc operand types must match!"); 03767 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); 03768 ;} 03769 break; 03770 03771 case 113: 03772 #line 1536 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03773 { 03774 if ((yyvsp[(5) - (6)].ConstVal)->getType() != Type::UByteTy) 03775 ThrowException("Shift count for shift constant must be unsigned byte!"); 03776 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) 03777 ThrowException("Shift constant expression requires integer operand!"); 03778 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); 03779 ;} 03780 break; 03781 03782 case 114: 03783 #line 1543 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03784 { 03785 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) 03786 ThrowException("Invalid extractelement operands!"); 03787 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); 03788 ;} 03789 break; 03790 03791 case 115: 03792 #line 1548 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03793 { 03794 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) 03795 ThrowException("Invalid insertelement operands!"); 03796 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); 03797 ;} 03798 break; 03799 03800 case 116: 03801 #line 1553 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03802 { 03803 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) 03804 ThrowException("Invalid shufflevector operands!"); 03805 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); 03806 ;} 03807 break; 03808 03809 case 117: 03810 #line 1561 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03811 { 03812 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); 03813 ;} 03814 break; 03815 03816 case 118: 03817 #line 1564 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03818 { 03819 (yyval.ConstVector) = new std::vector<Constant*>(); 03820 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); 03821 ;} 03822 break; 03823 03824 case 119: 03825 #line 1571 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03826 { (yyval.BoolVal) = false; ;} 03827 break; 03828 03829 case 120: 03830 #line 1571 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03831 { (yyval.BoolVal) = true; ;} 03832 break; 03833 03834 case 121: 03835 #line 1581 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03836 { 03837 (yyval.ModuleVal) = ParserResult = (yyvsp[(1) - (1)].ModuleVal); 03838 CurModule.ModuleDone(); 03839 ;} 03840 break; 03841 03842 case 122: 03843 #line 1588 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03844 { 03845 (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); 03846 CurFun.FunctionDone(); 03847 ;} 03848 break; 03849 03850 case 123: 03851 #line 1592 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03852 { 03853 (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); 03854 ;} 03855 break; 03856 03857 case 124: 03858 #line 1595 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03859 { 03860 (yyval.ModuleVal) = (yyvsp[(1) - (4)].ModuleVal); 03861 ;} 03862 break; 03863 03864 case 125: 03865 #line 1598 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03866 { 03867 (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); 03868 ;} 03869 break; 03870 03871 case 126: 03872 #line 1601 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03873 { 03874 (yyval.ModuleVal) = CurModule.CurrentModule; 03875 // Emit an error if there are any unresolved types left. 03876 if (!CurModule.LateResolveTypes.empty()) { 03877 const ValID &DID = CurModule.LateResolveTypes.begin()->first; 03878 if (DID.Type == ValID::NameVal) 03879 ThrowException("Reference to an undefined type: '"+DID.getName() + "'"); 03880 else 03881 ThrowException("Reference to an undefined type: #" + itostr(DID.Num)); 03882 } 03883 ;} 03884 break; 03885 03886 case 127: 03887 #line 1614 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03888 { 03889 // Eagerly resolve types. This is not an optimization, this is a 03890 // requirement that is due to the fact that we could have this: 03891 // 03892 // %list = type { %list * } 03893 // %list = type { %list * } ; repeated type decl 03894 // 03895 // If types are not resolved eagerly, then the two types will not be 03896 // determined to be the same type! 03897 // 03898 ResolveTypeTo((yyvsp[(2) - (4)].StrVal), *(yyvsp[(4) - (4)].TypeVal)); 03899 03900 if (!setTypeName(*(yyvsp[(4) - (4)].TypeVal), (yyvsp[(2) - (4)].StrVal)) && !(yyvsp[(2) - (4)].StrVal)) { 03901 // If this is a named type that is not a redefinition, add it to the slot 03902 // table. 03903 CurModule.Types.push_back(*(yyvsp[(4) - (4)].TypeVal)); 03904 } 03905 03906 delete (yyvsp[(4) - (4)].TypeVal); 03907 ;} 03908 break; 03909 03910 case 128: 03911 #line 1634 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03912 { // Function prototypes can be in const pool 03913 ;} 03914 break; 03915 03916 case 129: 03917 #line 1636 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03918 { // Asm blocks can be in the const pool 03919 ;} 03920 break; 03921 03922 case 130: 03923 #line 1638 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03924 { 03925 if ((yyvsp[(5) - (5)].ConstVal) == 0) ThrowException("Global value initializer is not a constant!"); 03926 CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), (yyvsp[(3) - (5)].Linkage), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal)); 03927 ;} 03928 break; 03929 03930 case 131: 03931 #line 1641 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03932 { 03933 CurGV = 0; 03934 ;} 03935 break; 03936 03937 case 132: 03938 #line 1644 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03939 { 03940 CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::ExternalLinkage, 03941 (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); 03942 delete (yyvsp[(5) - (5)].TypeVal); 03943 ;} 03944 break; 03945 03946 case 133: 03947 #line 1648 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03948 { 03949 CurGV = 0; 03950 ;} 03951 break; 03952 03953 case 134: 03954 #line 1651 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03955 { 03956 ;} 03957 break; 03958 03959 case 135: 03960 #line 1653 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03961 { 03962 ;} 03963 break; 03964 03965 case 136: 03966 #line 1655 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03967 { 03968 ;} 03969 break; 03970 03971 case 137: 03972 #line 1659 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03973 { 03974 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); 03975 char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true); 03976 std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr); 03977 free((yyvsp[(1) - (1)].StrVal)); 03978 03979 if (AsmSoFar.empty()) 03980 CurModule.CurrentModule->setModuleInlineAsm(NewAsm); 03981 else 03982 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); 03983 ;} 03984 break; 03985 03986 case 138: 03987 #line 1671 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03988 { (yyval.Endianness) = Module::BigEndian; ;} 03989 break; 03990 03991 case 139: 03992 #line 1672 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03993 { (yyval.Endianness) = Module::LittleEndian; ;} 03994 break; 03995 03996 case 140: 03997 #line 1674 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 03998 { 03999 CurModule.CurrentModule->setEndianness((yyvsp[(3) - (3)].Endianness)); 04000 ;} 04001 break; 04002 04003 case 141: 04004 #line 1677 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04005 { 04006 if ((yyvsp[(3) - (3)].UInt64Val) == 32) 04007 CurModule.CurrentModule->setPointerSize(Module::Pointer32); 04008 else if ((yyvsp[(3) - (3)].UInt64Val) == 64) 04009 CurModule.CurrentModule->setPointerSize(Module::Pointer64); 04010 else 04011 ThrowException("Invalid pointer size: '" + utostr((yyvsp[(3) - (3)].UInt64Val)) + "'!"); 04012 ;} 04013 break; 04014 04015 case 142: 04016 #line 1685 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04017 { 04018 CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal)); 04019 free((yyvsp[(3) - (3)].StrVal)); 04020 ;} 04021 break; 04022 04023 case 144: 04024 #line 1692 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04025 { 04026 CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal)); 04027 free((yyvsp[(3) - (3)].StrVal)); 04028 ;} 04029 break; 04030 04031 case 145: 04032 #line 1696 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04033 { 04034 CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal)); 04035 free((yyvsp[(1) - (1)].StrVal)); 04036 ;} 04037 break; 04038 04039 case 146: 04040 #line 1700 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04041 { 04042 ;} 04043 break; 04044 04045 case 150: 04046 #line 1709 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04047 { (yyval.StrVal) = 0; ;} 04048 break; 04049 04050 case 151: 04051 #line 1711 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04052 { 04053 if (*(yyvsp[(1) - (2)].TypeVal) == Type::VoidTy) 04054 ThrowException("void typed arguments are invalid!"); 04055 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].StrVal)); 04056 ;} 04057 break; 04058 04059 case 152: 04060 #line 1717 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04061 { 04062 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); 04063 (yyvsp[(1) - (3)].ArgList)->push_back(*(yyvsp[(3) - (3)].ArgVal)); 04064 delete (yyvsp[(3) - (3)].ArgVal); 04065 ;} 04066 break; 04067 04068 case 153: 04069 #line 1722 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04070 { 04071 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >(); 04072 (yyval.ArgList)->push_back(*(yyvsp[(1) - (1)].ArgVal)); 04073 delete (yyvsp[(1) - (1)].ArgVal); 04074 ;} 04075 break; 04076 04077 case 154: 04078 #line 1728 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04079 { 04080 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); 04081 ;} 04082 break; 04083 04084 case 155: 04085 #line 1731 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04086 { 04087 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); 04088 (yyval.ArgList)->push_back(std::pair<PATypeHolder*, 04089 char*>(new PATypeHolder(Type::VoidTy), 0)); 04090 ;} 04091 break; 04092 04093 case 156: 04094 #line 1736 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04095 { 04096 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >(); 04097 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); 04098 ;} 04099 break; 04100 04101 case 157: 04102 #line 1740 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04103 { 04104 (yyval.ArgList) = 0; 04105 ;} 04106 break; 04107 04108 case 158: 04109 #line 1745 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04110 { 04111 UnEscapeLexed((yyvsp[(3) - (8)].StrVal)); 04112 std::string FunctionName((yyvsp[(3) - (8)].StrVal)); 04113 free((yyvsp[(3) - (8)].StrVal)); // Free strdup'd memory! 04114 04115 if (!(*(yyvsp[(2) - (8)].TypeVal))->isFirstClassType() && *(yyvsp[(2) - (8)].TypeVal) != Type::VoidTy) 04116 ThrowException("LLVM functions cannot return aggregate types!"); 04117 04118 std::vector<const Type*> ParamTypeList; 04119 if ((yyvsp[(5) - (8)].ArgList)) { // If there are arguments... 04120 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); 04121 I != (yyvsp[(5) - (8)].ArgList)->end(); ++I) 04122 ParamTypeList.push_back(I->first->get()); 04123 } 04124 04125 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; 04126 if (isVarArg) ParamTypeList.pop_back(); 04127 04128 const FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (8)].TypeVal), ParamTypeList, isVarArg); 04129 const PointerType *PFT = PointerType::get(FT); 04130 delete (yyvsp[(2) - (8)].TypeVal); 04131 04132 ValID ID; 04133 if (!FunctionName.empty()) { 04134 ID = ValID::create((char*)FunctionName.c_str()); 04135 } else { 04136 ID = ValID::create((int)CurModule.Values[PFT].size()); 04137 } 04138 04139 Function *Fn = 0; 04140 // See if this function was forward referenced. If so, recycle the object. 04141 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { 04142 // Move the function to the end of the list, from whereever it was 04143 // previously inserted. 04144 Fn = cast<Function>(FWRef); 04145 CurModule.CurrentModule->getFunctionList().remove(Fn); 04146 CurModule.CurrentModule->getFunctionList().push_back(Fn); 04147 } else if (!FunctionName.empty() && // Merge with an earlier prototype? 04148 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { 04149 // If this is the case, either we need to be a forward decl, or it needs 04150 // to be. 04151 if (!CurFun.isDeclare && !Fn->isExternal()) 04152 ThrowException("Redefinition of function '" + FunctionName + "'!"); 04153 04154 // Make sure to strip off any argument names so we can't get conflicts. 04155 if (Fn->isExternal()) 04156 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); 04157 AI != AE; ++AI) 04158 AI->setName(""); 04159 04160 } else { // Not already defined? 04161 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, 04162 CurModule.CurrentModule); 04163 InsertValue(Fn, CurModule.Values); 04164 } 04165 04166 CurFun.FunctionStart(Fn); 04167 Fn->setCallingConv((yyvsp[(1) - (8)].UIntVal)); 04168 Fn->setAlignment((yyvsp[(8) - (8)].UIntVal)); 04169 if ((yyvsp[(7) - (8)].StrVal)) { 04170 Fn->setSection((yyvsp[(7) - (8)].StrVal)); 04171 free((yyvsp[(7) - (8)].StrVal)); 04172 } 04173 04174 // Add all of the arguments we parsed to the function... 04175 if ((yyvsp[(5) - (8)].ArgList)) { // Is null if empty... 04176 if (isVarArg) { // Nuke the last entry 04177 assert((yyvsp[(5) - (8)].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[(5) - (8)].ArgList)->back().second == 0&& 04178 "Not a varargs marker!"); 04179 delete (yyvsp[(5) - (8)].ArgList)->back().first; 04180 (yyvsp[(5) - (8)].ArgList)->pop_back(); // Delete the last entry 04181 } 04182 Function::arg_iterator ArgIt = Fn->arg_begin(); 04183 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); 04184 I != (yyvsp[(5) - (8)].ArgList)->end(); ++I, ++ArgIt) { 04185 delete I->first; // Delete the typeholder... 04186 04187 setValueName(ArgIt, I->second); // Insert arg into symtab... 04188 InsertValue(ArgIt); 04189 } 04190 04191 delete (yyvsp[(5) - (8)].ArgList); // We're now done with the argument list 04192 } 04193 ;} 04194 break; 04195 04196 case 161: 04197 #line 1832 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04198 { 04199 (yyval.FunctionVal) = CurFun.CurrentFunction; 04200 04201 // Make sure that we keep track of the linkage type even if there was a 04202 // previous "declare". 04203 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (3)].Linkage)); 04204 ;} 04205 break; 04206 04207 case 164: 04208 #line 1842 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04209 { 04210 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); 04211 ;} 04212 break; 04213 04214 case 165: 04215 #line 1846 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04216 { CurFun.isDeclare = true; ;} 04217 break; 04218 04219 case 166: 04220 #line 1846 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04221 { 04222 (yyval.FunctionVal) = CurFun.CurrentFunction; 04223 CurFun.FunctionDone(); 04224 ;} 04225 break; 04226 04227 case 167: 04228 #line 1855 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04229 { 04230 (yyval.BoolVal) = false; 04231 ;} 04232 break; 04233 04234 case 168: 04235 #line 1858 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04236 { 04237 (yyval.BoolVal) = true; 04238 ;} 04239 break; 04240 04241 case 169: 04242 #line 1862 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04243 { // A reference to a direct constant 04244 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); 04245 ;} 04246 break; 04247 04248 case 170: 04249 #line 1865 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04250 { 04251 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); 04252 ;} 04253 break; 04254 04255 case 171: 04256 #line 1868 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04257 { // Perhaps it's an FP constant? 04258 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); 04259 ;} 04260 break; 04261 04262 case 172: 04263 #line 1871 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04264 { 04265 (yyval.ValIDVal) = ValID::create(ConstantBool::True); 04266 ;} 04267 break; 04268 04269 case 173: 04270 #line 1874 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04271 { 04272 (yyval.ValIDVal) = ValID::create(ConstantBool::False); 04273 ;} 04274 break; 04275 04276 case 174: 04277 #line 1877 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04278 { 04279 (yyval.ValIDVal) = ValID::createNull(); 04280 ;} 04281 break; 04282 04283 case 175: 04284 #line 1880 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04285 { 04286 (yyval.ValIDVal) = ValID::createUndef(); 04287 ;} 04288 break; 04289 04290 case 176: 04291 #line 1883 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04292 { // A vector zero constant. 04293 (yyval.ValIDVal) = ValID::createZeroInit(); 04294 ;} 04295 break; 04296 04297 case 177: 04298 #line 1886 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04299 { // Nonempty unsized packed vector 04300 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); 04301 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); 04302 04303 PackedType* pt = PackedType::get(ETy, NumElements); 04304 PATypeHolder* PTy = new PATypeHolder( 04305 HandleUpRefs( 04306 PackedType::get( 04307 ETy, 04308 NumElements) 04309 ) 04310 ); 04311 04312 // Verify all elements are correct type! 04313 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { 04314 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) 04315 ThrowException("Element #" + utostr(i) + " is not of type '" + 04316 ETy->getDescription() +"' as required!\nIt is of type '" + 04317 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); 04318 } 04319 04320 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[(2) - (3)].ConstVector))); 04321 delete PTy; delete (yyvsp[(2) - (3)].ConstVector); 04322 ;} 04323 break; 04324 04325 case 178: 04326 #line 1910 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04327 { 04328 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); 04329 ;} 04330 break; 04331 04332 case 179: 04333 #line 1913 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04334 { 04335 char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true); 04336 std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End); 04337 End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true); 04338 std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End); 04339 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal)); 04340 free((yyvsp[(3) - (5)].StrVal)); 04341 free((yyvsp[(5) - (5)].StrVal)); 04342 ;} 04343 break; 04344 04345 case 180: 04346 #line 1926 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04347 { // Is it an integer reference...? 04348 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SIntVal)); 04349 ;} 04350 break; 04351 04352 case 181: 04353 #line 1929 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04354 { // Is it a named reference...? 04355 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].StrVal)); 04356 ;} 04357 break; 04358 04359 case 184: 04360 #line 1940 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04361 { 04362 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); delete (yyvsp[(1) - (2)].TypeVal); 04363 ;} 04364 break; 04365 04366 case 185: 04367 #line 1944 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04368 { 04369 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); 04370 ;} 04371 break; 04372 04373 case 186: 04374 #line 1947 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04375 { // Do not allow functions with 0 basic blocks 04376 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); 04377 ;} 04378 break; 04379 04380 case 187: 04381 #line 1955 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04382 { 04383 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); 04384 InsertValue((yyvsp[(3) - (3)].TermInstVal)); 04385 04386 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); 04387 InsertValue((yyvsp[(1) - (3)].BasicBlockVal)); 04388 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); 04389 ;} 04390 break; 04391 04392 case 188: 04393 #line 1964 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04394 { 04395 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); 04396 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); 04397 ;} 04398 break; 04399 04400 case 189: 04401 #line 1968 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04402 { 04403 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); 04404 04405 // Make sure to move the basic block to the correct location in the 04406 // function, instead of leaving it inserted wherever it was first 04407 // referenced. 04408 Function::BasicBlockListType &BBL = 04409 CurFun.CurrentFunction->getBasicBlockList(); 04410 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); 04411 ;} 04412 break; 04413 04414 case 190: 04415 #line 1978 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04416 { 04417 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[(1) - (1)].StrVal)), true); 04418 04419 // Make sure to move the basic block to the correct location in the 04420 // function, instead of leaving it inserted wherever it was first 04421 // referenced. 04422 Function::BasicBlockListType &BBL = 04423 CurFun.CurrentFunction->getBasicBlockList(); 04424 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); 04425 ;} 04426 break; 04427 04428 case 191: 04429 #line 1989 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04430 { // Return with a result... 04431 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal)); 04432 ;} 04433 break; 04434 04435 case 192: 04436 #line 1992 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04437 { // Return with no result... 04438 (yyval.TermInstVal) = new ReturnInst(); 04439 ;} 04440 break; 04441 04442 case 193: 04443 #line 1995 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04444 { // Unconditional Branch... 04445 (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[(3) - (3)].ValIDVal))); 04446 ;} 04447 break; 04448 04449 case 194: 04450 #line 1998 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04451 { 04452 (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[(6) - (9)].ValIDVal)), getBBVal((yyvsp[(9) - (9)].ValIDVal)), getVal(Type::BoolTy, (yyvsp[(3) - (9)].ValIDVal))); 04453 ;} 04454 break; 04455 04456 case 195: 04457 #line 2001 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04458 { 04459 SwitchInst *S = new SwitchInst(getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)), getBBVal((yyvsp[(6) - (9)].ValIDVal)), (yyvsp[(8) - (9)].JumpTable)->size()); 04460 (yyval.TermInstVal) = S; 04461 04462 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), 04463 E = (yyvsp[(8) - (9)].JumpTable)->end(); 04464 for (; I != E; ++I) { 04465 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) 04466 S->addCase(CI, I->second); 04467 else 04468 ThrowException("Switch case is constant, but not a simple integer!"); 04469 } 04470 delete (yyvsp[(8) - (9)].JumpTable); 04471 ;} 04472 break; 04473 04474 case 196: 04475 #line 2015 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04476 { 04477 SwitchInst *S = new SwitchInst(getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)), getBBVal((yyvsp[(6) - (8)].ValIDVal)), 0); 04478 (yyval.TermInstVal) = S; 04479 ;} 04480 break; 04481 04482 case 197: 04483 #line 2020 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04484 { 04485 const PointerType *PFTy; 04486 const FunctionType *Ty; 04487 04488 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (13)].TypeVal)->get())) || 04489 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { 04490 // Pull out the types of all of the arguments... 04491 std::vector<const Type*> ParamTypes; 04492 if ((yyvsp[(6) - (13)].ValueList)) { 04493 for (std::vector<Value*>::iterator I = (yyvsp[(6) - (13)].ValueList)->begin(), E = (yyvsp[(6) - (13)].ValueList)->end(); 04494 I != E; ++I) 04495 ParamTypes.push_back((*I)->getType()); 04496 } 04497 04498 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; 04499 if (isVarArg) ParamTypes.pop_back(); 04500 04501 Ty = FunctionType::get((yyvsp[(3) - (13)].TypeVal)->get(), ParamTypes, isVarArg); 04502 PFTy = PointerType::get(Ty); 04503 } 04504 04505 Value *V = getVal(PFTy, (yyvsp[(4) - (13)].ValIDVal)); // Get the function we're calling... 04506 04507 BasicBlock *Normal = getBBVal((yyvsp[(10) - (13)].ValIDVal)); 04508 BasicBlock *Except = getBBVal((yyvsp[(13) - (13)].ValIDVal)); 04509 04510 // Create the call node... 04511 if (!(yyvsp[(6) - (13)].ValueList)) { // Has no arguments? 04512 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>()); 04513 } else { // Has arguments? 04514 // Loop through FunctionType's arguments and ensure they are specified 04515 // correctly! 04516 // 04517 FunctionType::param_iterator I = Ty->param_begin(); 04518 FunctionType::param_iterator E = Ty->param_end(); 04519 std::vector<Value*>::iterator ArgI = (yyvsp[(6) - (13)].ValueList)->begin(), ArgE = (yyvsp[(6) - (13)].ValueList)->end(); 04520 04521 for (; ArgI != ArgE && I != E; ++ArgI, ++I) 04522 if ((*ArgI)->getType() != *I) 04523 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + 04524 (*I)->getDescription() + "'!"); 04525 04526 if (I != E || (ArgI != ArgE && !Ty->isVarArg())) 04527 ThrowException("Invalid number of parameters detected!"); 04528 04529 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[(6) - (13)].ValueList)); 04530 } 04531 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[(2) - (13)].UIntVal)); 04532 04533 delete (yyvsp[(3) - (13)].TypeVal); 04534 delete (yyvsp[(6) - (13)].ValueList); 04535 ;} 04536 break; 04537 04538 case 198: 04539 #line 2072 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04540 { 04541 (yyval.TermInstVal) = new UnwindInst(); 04542 ;} 04543 break; 04544 04545 case 199: 04546 #line 2075 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04547 { 04548 (yyval.TermInstVal) = new UnreachableInst(); 04549 ;} 04550 break; 04551 04552 case 200: 04553 #line 2081 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04554 { 04555 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); 04556 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); 04557 if (V == 0) 04558 ThrowException("May only switch on a constant pool value!"); 04559 04560 (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[(6) - (6)].ValIDVal)))); 04561 ;} 04562 break; 04563 04564 case 201: 04565 #line 2089 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04566 { 04567 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); 04568 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); 04569 04570 if (V == 0) 04571 ThrowException("May only switch on a constant pool value!"); 04572 04573 (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[(5) - (5)].ValIDVal)))); 04574 ;} 04575 break; 04576 04577 case 202: 04578 #line 2099 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04579 { 04580 // Is this definition named?? if so, assign the name... 04581 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); 04582 InsertValue((yyvsp[(2) - (2)].InstVal)); 04583 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); 04584 ;} 04585 break; 04586 04587 case 203: 04588 #line 2106 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04589 { // Used for PHI nodes 04590 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); 04591 (yyval.PHIList)->push_back(std::make_pair(getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)), getBBVal((yyvsp[(5) - (6)].ValIDVal)))); 04592 delete (yyvsp[(1) - (6)].TypeVal); 04593 ;} 04594 break; 04595 04596 case 204: 04597 #line 2111 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04598 { 04599 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); 04600 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)), 04601 getBBVal((yyvsp[(6) - (7)].ValIDVal)))); 04602 ;} 04603 break; 04604 04605 case 205: 04606 #line 2118 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04607 { // Used for call statements, and memory insts... 04608 (yyval.ValueList) = new std::vector<Value*>(); 04609 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); 04610 ;} 04611 break; 04612 04613 case 206: 04614 #line 2122 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04615 { 04616 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); 04617 (yyvsp[(1) - (3)].ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); 04618 ;} 04619 break; 04620 04621 case 208: 04622 #line 2128 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04623 { (yyval.ValueList) = 0; ;} 04624 break; 04625 04626 case 209: 04627 #line 2130 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04628 { 04629 (yyval.BoolVal) = true; 04630 ;} 04631 break; 04632 04633 case 210: 04634 #line 2133 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04635 { 04636 (yyval.BoolVal) = false; 04637 ;} 04638 break; 04639 04640 case 211: 04641 #line 2139 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04642 { 04643 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && 04644 !isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get())) 04645 ThrowException( 04646 "Arithmetic operator requires integer, FP, or packed operands!"); 04647 if (isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get()) && (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::Rem) 04648 ThrowException("Rem not supported on packed types!"); 04649 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal))); 04650 if ((yyval.InstVal) == 0) 04651 ThrowException("binary operator returned null!"); 04652 delete (yyvsp[(2) - (5)].TypeVal); 04653 ;} 04654 break; 04655 04656 case 212: 04657 #line 2151 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04658 { 04659 if (!(*(yyvsp[(2) - (5)].TypeVal))->isIntegral()) { 04660 if (!isa<PackedType>((yyvsp[(2) - (5)].TypeVal)->get()) || 04661 !cast<PackedType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isIntegral()) 04662 ThrowException("Logical operator requires integral operands!"); 04663 } 04664 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal))); 04665 if ((yyval.InstVal) == 0) 04666 ThrowException("binary operator returned null!"); 04667 delete (yyvsp[(2) - (5)].TypeVal); 04668 ;} 04669 break; 04670 04671 case 213: 04672 #line 2162 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04673 { 04674 if(isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get())) { 04675 ThrowException( 04676 "PackedTypes currently not supported in setcc instructions!"); 04677 } 04678 (yyval.InstVal) = new SetCondInst((yyvsp[(1) - (5)].BinaryOpVal), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal))); 04679 if ((yyval.InstVal) == 0) 04680 ThrowException("binary operator returned null!"); 04681 delete (yyvsp[(2) - (5)].TypeVal); 04682 ;} 04683 break; 04684 04685 case 214: 04686 #line 2172 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04687 { 04688 std::cerr << "WARNING: Use of eliminated 'not' instruction:" 04689 << " Replacing with 'xor'.\n"; 04690 04691 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[(2) - (2)].ValueVal)->getType()); 04692 if (Ones == 0) 04693 ThrowException("Expected integral type for not instruction!"); 04694 04695 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[(2) - (2)].ValueVal), Ones); 04696 if ((yyval.InstVal) == 0) 04697 ThrowException("Could not create a xor instruction!"); 04698 ;} 04699 break; 04700 04701 case 215: 04702 #line 2184 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04703 { 04704 if ((yyvsp[(4) - (4)].ValueVal)->getType() != Type::UByteTy) 04705 ThrowException("Shift amount must be ubyte!"); 04706 if (!(yyvsp[(2) - (4)].ValueVal)->getType()->isInteger()) 04707 ThrowException("Shift constant expression requires integer operand!"); 04708 (yyval.InstVal) = new ShiftInst((yyvsp[(1) - (4)].OtherOpVal), (yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); 04709 ;} 04710 break; 04711 04712 case 216: 04713 #line 2191 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04714 { 04715 if (!(yyvsp[(4) - (4)].TypeVal)->get()->isFirstClassType()) 04716 ThrowException("cast instruction to a non-primitive type: '" + 04717 (yyvsp[(4) - (4)].TypeVal)->get()->getDescription() + "'!"); 04718 (yyval.InstVal) = new CastInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); 04719 delete (yyvsp[(4) - (4)].TypeVal); 04720 ;} 04721 break; 04722 04723 case 217: 04724 #line 2198 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04725 { 04726 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::BoolTy) 04727 ThrowException("select condition must be boolean!"); 04728 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) 04729 ThrowException("select value types should match!"); 04730 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); 04731 ;} 04732 break; 04733 04734 case 218: 04735 #line 2205 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04736 { 04737 NewVarArgs = true; 04738 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); 04739 delete (yyvsp[(4) - (4)].TypeVal); 04740 ;} 04741 break; 04742 04743 case 219: 04744 #line 2210 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04745 { 04746 ObsoleteVarArgs = true; 04747 const Type* ArgTy = (yyvsp[(2) - (4)].ValueVal)->getType(); 04748 Function* NF = CurModule.CurrentModule-> 04749 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); 04750 04751 //b = vaarg a, t -> 04752 //foo = alloca 1 of t 04753 //bar = vacopy a 04754 //store bar -> foo 04755 //b = vaarg foo, t 04756 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); 04757 CurBB->getInstList().push_back(foo); 04758 CallInst* bar = new CallInst(NF, (yyvsp[(2) - (4)].ValueVal)); 04759 CurBB->getInstList().push_back(bar); 04760 CurBB->getInstList().push_back(new StoreInst(bar, foo)); 04761 (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[(4) - (4)].TypeVal)); 04762 delete (yyvsp[(4) - (4)].TypeVal); 04763 ;} 04764 break; 04765 04766 case 220: 04767 #line 2229 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04768 { 04769 ObsoleteVarArgs = true; 04770 const Type* ArgTy = (yyvsp[(2) - (4)].ValueVal)->getType(); 04771 Function* NF = CurModule.CurrentModule-> 04772 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); 04773 04774 //b = vanext a, t -> 04775 //foo = alloca 1 of t 04776 //bar = vacopy a 04777 //store bar -> foo 04778 //tmp = vaarg foo, t 04779 //b = load foo 04780 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); 04781 CurBB->getInstList().push_back(foo); 04782 CallInst* bar = new CallInst(NF, (yyvsp[(2) - (4)].ValueVal)); 04783 CurBB->getInstList().push_back(bar); 04784 CurBB->getInstList().push_back(new StoreInst(bar, foo)); 04785 Instruction* tmp = new VAArgInst(foo, *(yyvsp[(4) - (4)].TypeVal)); 04786 CurBB->getInstList().push_back(tmp); 04787 (yyval.InstVal) = new LoadInst(foo); 04788 delete (yyvsp[(4) - (4)].TypeVal); 04789 ;} 04790 break; 04791 04792 case 221: 04793 #line 2251 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04794 { 04795 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) 04796 ThrowException("Invalid extractelement operands!"); 04797 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); 04798 ;} 04799 break; 04800 04801 case 222: 04802 #line 2256 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04803 { 04804 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) 04805 ThrowException("Invalid insertelement operands!"); 04806 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); 04807 ;} 04808 break; 04809 04810 case 223: 04811 #line 2261 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04812 { 04813 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) 04814 ThrowException("Invalid shufflevector operands!"); 04815 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); 04816 ;} 04817 break; 04818 04819 case 224: 04820 #line 2266 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04821 { 04822 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); 04823 if (!Ty->isFirstClassType()) 04824 ThrowException("PHI node operands must be of first class type!"); 04825 (yyval.InstVal) = new PHINode(Ty); 04826 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); 04827 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { 04828 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) 04829 ThrowException("All elements of a PHI node must be of the same type!"); 04830 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); 04831 (yyvsp[(2) - (2)].PHIList)->pop_front(); 04832 } 04833 delete (yyvsp[(2) - (2)].PHIList); // Free the list... 04834 ;} 04835 break; 04836 04837 case 225: 04838 #line 2280 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04839 { 04840 const PointerType *PFTy; 04841 const FunctionType *Ty; 04842 04843 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (7)].TypeVal)->get())) || 04844 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { 04845 // Pull out the types of all of the arguments... 04846 std::vector<const Type*> ParamTypes; 04847 if ((yyvsp[(6) - (7)].ValueList)) { 04848 for (std::vector<Value*>::iterator I = (yyvsp[(6) - (7)].ValueList)->begin(), E = (yyvsp[(6) - (7)].ValueList)->end(); 04849 I != E; ++I) 04850 ParamTypes.push_back((*I)->getType()); 04851 } 04852 04853 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; 04854 if (isVarArg) ParamTypes.pop_back(); 04855 04856 if (!(*(yyvsp[(3) - (7)].TypeVal))->isFirstClassType() && *(yyvsp[(3) - (7)].TypeVal) != Type::VoidTy) 04857 ThrowException("LLVM functions cannot return aggregate types!"); 04858 04859 Ty = FunctionType::get((yyvsp[(3) - (7)].TypeVal)->get(), ParamTypes, isVarArg); 04860 PFTy = PointerType::get(Ty); 04861 } 04862 04863 Value *V = getVal(PFTy, (yyvsp[(4) - (7)].ValIDVal)); // Get the function we're calling... 04864 04865 // Create the call node... 04866 if (!(yyvsp[(6) - (7)].ValueList)) { // Has no arguments? 04867 // Make sure no arguments is a good thing! 04868 if (Ty->getNumParams() != 0) 04869 ThrowException("No arguments passed to a function that " 04870 "expects arguments!"); 04871 04872 (yyval.InstVal) = new CallInst(V, std::vector<Value*>()); 04873 } else { // Has arguments? 04874 // Loop through FunctionType's arguments and ensure they are specified 04875 // correctly! 04876 // 04877 FunctionType::param_iterator I = Ty->param_begin(); 04878 FunctionType::param_iterator E = Ty->param_end(); 04879 std::vector<Value*>::iterator ArgI = (yyvsp[(6) - (7)].ValueList)->begin(), ArgE = (yyvsp[(6) - (7)].ValueList)->end(); 04880 04881 for (; ArgI != ArgE && I != E; ++ArgI, ++I) 04882 if ((*ArgI)->getType() != *I) 04883 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + 04884 (*I)->getDescription() + "'!"); 04885 04886 if (I != E || (ArgI != ArgE && !Ty->isVarArg())) 04887 ThrowException("Invalid number of parameters detected!"); 04888 04889 (yyval.InstVal) = new CallInst(V, *(yyvsp[(6) - (7)].ValueList)); 04890 } 04891 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[(1) - (7)].BoolVal)); 04892 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[(2) - (7)].UIntVal)); 04893 delete (yyvsp[(3) - (7)].TypeVal); 04894 delete (yyvsp[(6) - (7)].ValueList); 04895 ;} 04896 break; 04897 04898 case 226: 04899 #line 2337 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04900 { 04901 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); 04902 ;} 04903 break; 04904 04905 case 227: 04906 #line 2343 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04907 { 04908 (yyval.ValueList) = (yyvsp[(2) - (2)].ValueList); 04909 ;} 04910 break; 04911 04912 case 228: 04913 #line 2345 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04914 { 04915 (yyval.ValueList) = new std::vector<Value*>(); 04916 ;} 04917 break; 04918 04919 case 229: 04920 #line 2349 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04921 { 04922 (yyval.BoolVal) = true; 04923 ;} 04924 break; 04925 04926 case 230: 04927 #line 2352 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04928 { 04929 (yyval.BoolVal) = false; 04930 ;} 04931 break; 04932 04933 case 231: 04934 #line 2358 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04935 { 04936 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); 04937 delete (yyvsp[(2) - (3)].TypeVal); 04938 ;} 04939 break; 04940 04941 case 232: 04942 #line 2362 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04943 { 04944 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)), (yyvsp[(6) - (6)].UIntVal)); 04945 delete (yyvsp[(2) - (6)].TypeVal); 04946 ;} 04947 break; 04948 04949 case 233: 04950 #line 2366 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04951 { 04952 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); 04953 delete (yyvsp[(2) - (3)].TypeVal); 04954 ;} 04955 break; 04956 04957 case 234: 04958 #line 2370 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04959 { 04960 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)), (yyvsp[(6) - (6)].UIntVal)); 04961 delete (yyvsp[(2) - (6)].TypeVal); 04962 ;} 04963 break; 04964 04965 case 235: 04966 #line 2374 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04967 { 04968 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) 04969 ThrowException("Trying to free nonpointer type " + 04970 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "!"); 04971 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); 04972 ;} 04973 break; 04974 04975 case 236: 04976 #line 2381 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04977 { 04978 if (!isa<PointerType>((yyvsp[(3) - (4)].TypeVal)->get())) 04979 ThrowException("Can't load from nonpointer type: " + 04980 (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); 04981 if (!cast<PointerType>((yyvsp[(3) - (4)].TypeVal)->get())->getElementType()->isFirstClassType()) 04982 ThrowException("Can't load from pointer of non-first-class type: " + 04983 (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); 04984 (yyval.InstVal) = new LoadInst(getVal(*(yyvsp[(3) - (4)].TypeVal), (yyvsp[(4) - (4)].ValIDVal)), "", (yyvsp[(1) - (4)].BoolVal)); 04985 delete (yyvsp[(3) - (4)].TypeVal); 04986 ;} 04987 break; 04988 04989 case 237: 04990 #line 2391 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 04991 { 04992 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (6)].TypeVal)->get()); 04993 if (!PT) 04994 ThrowException("Can't store to a nonpointer type: " + 04995 (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); 04996 const Type *ElTy = PT->getElementType(); 04997 if (ElTy != (yyvsp[(3) - (6)].ValueVal)->getType()) 04998 ThrowException("Can't store '" + (yyvsp[(3) - (6)].ValueVal)->getType()->getDescription() + 04999 "' into space of type '" + ElTy->getDescription() + "'!"); 05000 05001 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (6)].ValueVal), getVal(*(yyvsp[(5) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)), (yyvsp[(1) - (6)].BoolVal)); 05002 delete (yyvsp[(5) - (6)].TypeVal); 05003 ;} 05004 break; 05005 05006 case 238: 05007 #line 2404 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 05008 { 05009 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) 05010 ThrowException("getelementptr insn requires pointer operand!"); 05011 05012 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct 05013 // indices to uint struct indices for compatibility. 05014 generic_gep_type_iterator<std::vector<Value*>::iterator> 05015 GTI = gep_type_begin((yyvsp[(2) - (4)].TypeVal)->get(), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()), 05016 GTE = gep_type_end((yyvsp[(2) - (4)].TypeVal)->get(), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); 05017 for (unsigned i = 0, e = (yyvsp[(4) - (4)].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) 05018 if (isa<StructType>(*GTI)) // Only change struct indices 05019 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[(4) - (4)].ValueList))[i])) 05020 if (CUI->getType() == Type::UByteTy) 05021 (*(yyvsp[(4) - (4)].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); 05022 05023 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), *(yyvsp[(4) - (4)].ValueList), true)) 05024 ThrowException("Invalid getelementptr indices for type '" + 05025 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'!"); 05026 (yyval.InstVal) = new GetElementPtrInst(getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)), *(yyvsp[(4) - (4)].ValueList)); 05027 delete (yyvsp[(2) - (4)].TypeVal); delete (yyvsp[(4) - (4)].ValueList); 05028 ;} 05029 break; 05030 05031 05032 /* Line 1267 of yacc.c. */ 05033 #line 5034 "llvmAsmParser.tab.c" 05034 default: break; 05035 } 05036 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 05037 05038 YYPOPSTACK (yylen); 05039 yylen = 0; 05040 YY_STACK_PRINT (yyss, yyssp); 05041 05042 *++yyvsp = yyval; 05043 05044 05045 /* Now `shift' the result of the reduction. Determine what state 05046 that goes to, based on the state we popped back to and the rule 05047 number reduced by. */ 05048 05049 yyn = yyr1[yyn]; 05050 05051 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 05052 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 05053 yystate = yytable[yystate]; 05054 else 05055 yystate = yydefgoto[yyn - YYNTOKENS]; 05056 05057 goto yynewstate; 05058 05059 05060 /*------------------------------------. 05061 | yyerrlab -- here on detecting error | 05062 `------------------------------------*/ 05063 yyerrlab: 05064 /* If not already recovering from an error, report this error. */ 05065 if (!yyerrstatus) 05066 { 05067 ++yynerrs; 05068 #if ! YYERROR_VERBOSE 05069 yyerror (YY_("syntax error")); 05070 #else 05071 { 05072 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 05073 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 05074 { 05075 YYSIZE_T yyalloc = 2 * yysize; 05076 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 05077 yyalloc = YYSTACK_ALLOC_MAXIMUM; 05078 if (yymsg != yymsgbuf) 05079 YYSTACK_FREE (yymsg); 05080 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 05081 if (yymsg) 05082 yymsg_alloc = yyalloc; 05083 else 05084 { 05085 yymsg = yymsgbuf; 05086 yymsg_alloc = sizeof yymsgbuf; 05087 } 05088 } 05089 05090 if (0 < yysize && yysize <= yymsg_alloc) 05091 { 05092 (void) yysyntax_error (yymsg, yystate, yychar); 05093 yyerror (yymsg); 05094 } 05095 else 05096 { 05097 yyerror (YY_("syntax error")); 05098 if (yysize != 0) 05099 goto yyexhaustedlab; 05100 } 05101 } 05102 #endif 05103 } 05104 05105 05106 05107 if (yyerrstatus == 3) 05108 { 05109 /* If just tried and failed to reuse look-ahead token after an 05110 error, discard it. */ 05111 05112 if (yychar <= YYEOF) 05113 { 05114 /* Return failure if at end of input. */ 05115 if (yychar == YYEOF) 05116 YYABORT; 05117 } 05118 else 05119 { 05120 yydestruct ("Error: discarding", 05121 yytoken, &yylval); 05122 yychar = YYEMPTY; 05123 } 05124 } 05125 05126 /* Else will try to reuse look-ahead token after shifting the error 05127 token. */ 05128 goto yyerrlab1; 05129 05130 05131 /*---------------------------------------------------. 05132 | yyerrorlab -- error raised explicitly by YYERROR. | 05133 `---------------------------------------------------*/ 05134 yyerrorlab: 05135 05136 /* Pacify compilers like GCC when the user code never invokes 05137 YYERROR and the label yyerrorlab therefore never appears in user 05138 code. */ 05139 if (/*CONSTCOND*/ 0) 05140 goto yyerrorlab; 05141 05142 /* Do not reclaim the symbols of the rule which action triggered 05143 this YYERROR. */ 05144 YYPOPSTACK (yylen); 05145 yylen = 0; 05146 YY_STACK_PRINT (yyss, yyssp); 05147 yystate = *yyssp; 05148 goto yyerrlab1; 05149 05150 05151 /*-------------------------------------------------------------. 05152 | yyerrlab1 -- common code for both syntax error and YYERROR. | 05153 `-------------------------------------------------------------*/ 05154 yyerrlab1: 05155 yyerrstatus = 3; /* Each real token shifted decrements this. */ 05156 05157 for (;;) 05158 { 05159 yyn = yypact[yystate]; 05160 if (yyn != YYPACT_NINF) 05161 { 05162 yyn += YYTERROR; 05163 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 05164 { 05165 yyn = yytable[yyn]; 05166 if (0 < yyn) 05167 break; 05168 } 05169 } 05170 05171 /* Pop the current state because it cannot handle the error token. */ 05172 if (yyssp == yyss) 05173 YYABORT; 05174 05175 05176 yydestruct ("Error: popping", 05177 yystos[yystate], yyvsp); 05178 YYPOPSTACK (1); 05179 yystate = *yyssp; 05180 YY_STACK_PRINT (yyss, yyssp); 05181 } 05182 05183 if (yyn == YYFINAL) 05184 YYACCEPT; 05185 05186 *++yyvsp = yylval; 05187 05188 05189 /* Shift the error token. */ 05190 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 05191 05192 yystate = yyn; 05193 goto yynewstate; 05194 05195 05196 /*-------------------------------------. 05197 | yyacceptlab -- YYACCEPT comes here. | 05198 `-------------------------------------*/ 05199 yyacceptlab: 05200 yyresult = 0; 05201 goto yyreturn; 05202 05203 /*-----------------------------------. 05204 | yyabortlab -- YYABORT comes here. | 05205 `-----------------------------------*/ 05206 yyabortlab: 05207 yyresult = 1; 05208 goto yyreturn; 05209 05210 #ifndef yyoverflow 05211 /*-------------------------------------------------. 05212 | yyexhaustedlab -- memory exhaustion comes here. | 05213 `-------------------------------------------------*/ 05214 yyexhaustedlab: 05215 yyerror (YY_("memory exhausted")); 05216 yyresult = 2; 05217 /* Fall through. */ 05218 #endif 05219 05220 yyreturn: 05221 if (yychar != YYEOF && yychar != YYEMPTY) 05222 yydestruct ("Cleanup: discarding lookahead", 05223 yytoken, &yylval); 05224 /* Do not reclaim the symbols of the rule which action triggered 05225 this YYABORT or YYACCEPT. */ 05226 YYPOPSTACK (yylen); 05227 YY_STACK_PRINT (yyss, yyssp); 05228 while (yyssp != yyss) 05229 { 05230 yydestruct ("Cleanup: popping", 05231 yystos[*yyssp], yyvsp); 05232 YYPOPSTACK (1); 05233 } 05234 #ifndef yyoverflow 05235 if (yyss != yyssa) 05236 YYSTACK_FREE (yyss); 05237 #endif 05238 #if YYERROR_VERBOSE 05239 if (yymsg != yymsgbuf) 05240 YYSTACK_FREE (yymsg); 05241 #endif 05242 /* Make sure YYID is used. */ 05243 return YYID (yyresult); 05244 } 05245 05246 05247 #line 2427 "/build/buildd/llvm-1.7/llvm/lib/AsmParser/llvmAsmParser.y" 05248 05249 int yyerror(const char *ErrorMsg) { 05250 std::string where 05251 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) 05252 + ":" + utostr((unsigned) llvmAsmlineno) + ": "; 05253 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; 05254 if (yychar == YYEMPTY || yychar == 0) 05255 errMsg += "end-of-file."; 05256 else 05257 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; 05258 ThrowException(errMsg); 05259 return 0; 05260 } 05261