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 CSRETCC_TOK = 318, 00138 FASTCC_TOK = 319, 00139 COLDCC_TOK = 320, 00140 RET = 321, 00141 BR = 322, 00142 SWITCH = 323, 00143 INVOKE = 324, 00144 UNWIND = 325, 00145 UNREACHABLE = 326, 00146 ADD = 327, 00147 SUB = 328, 00148 MUL = 329, 00149 DIV = 330, 00150 REM = 331, 00151 AND = 332, 00152 OR = 333, 00153 XOR = 334, 00154 SETLE = 335, 00155 SETGE = 336, 00156 SETLT = 337, 00157 SETGT = 338, 00158 SETEQ = 339, 00159 SETNE = 340, 00160 MALLOC = 341, 00161 ALLOCA = 342, 00162 FREE = 343, 00163 LOAD = 344, 00164 STORE = 345, 00165 GETELEMENTPTR = 346, 00166 PHI_TOK = 347, 00167 CAST = 348, 00168 SELECT = 349, 00169 SHL = 350, 00170 SHR = 351, 00171 VAARG = 352, 00172 EXTRACTELEMENT = 353, 00173 INSERTELEMENT = 354, 00174 SHUFFLEVECTOR = 355, 00175 VAARG_old = 356, 00176 VANEXT_old = 357 00177 }; 00178 #endif 00179 /* Tokens. */ 00180 #define ESINT64VAL 258 00181 #define EUINT64VAL 259 00182 #define SINTVAL 260 00183 #define UINTVAL 261 00184 #define FPVAL 262 00185 #define VOID 263 00186 #define BOOL 264 00187 #define SBYTE 265 00188 #define UBYTE 266 00189 #define SHORT 267 00190 #define USHORT 268 00191 #define INT 269 00192 #define UINT 270 00193 #define LONG 271 00194 #define ULONG 272 00195 #define FLOAT 273 00196 #define DOUBLE 274 00197 #define TYPE 275 00198 #define LABEL 276 00199 #define VAR_ID 277 00200 #define LABELSTR 278 00201 #define STRINGCONSTANT 279 00202 #define IMPLEMENTATION 280 00203 #define ZEROINITIALIZER 281 00204 #define TRUETOK 282 00205 #define FALSETOK 283 00206 #define BEGINTOK 284 00207 #define ENDTOK 285 00208 #define DECLARE 286 00209 #define GLOBAL 287 00210 #define CONSTANT 288 00211 #define SECTION 289 00212 #define VOLATILE 290 00213 #define TO 291 00214 #define DOTDOTDOT 292 00215 #define NULL_TOK 293 00216 #define UNDEF 294 00217 #define CONST 295 00218 #define INTERNAL 296 00219 #define LINKONCE 297 00220 #define WEAK 298 00221 #define APPENDING 299 00222 #define OPAQUE 300 00223 #define NOT 301 00224 #define EXTERNAL 302 00225 #define TARGET 303 00226 #define TRIPLE 304 00227 #define ENDIAN 305 00228 #define POINTERSIZE 306 00229 #define LITTLE 307 00230 #define BIG 308 00231 #define ALIGN 309 00232 #define DEPLIBS 310 00233 #define CALL 311 00234 #define TAIL 312 00235 #define ASM_TOK 313 00236 #define MODULE 314 00237 #define SIDEEFFECT 315 00238 #define CC_TOK 316 00239 #define CCC_TOK 317 00240 #define CSRETCC_TOK 318 00241 #define FASTCC_TOK 319 00242 #define COLDCC_TOK 320 00243 #define RET 321 00244 #define BR 322 00245 #define SWITCH 323 00246 #define INVOKE 324 00247 #define UNWIND 325 00248 #define UNREACHABLE 326 00249 #define ADD 327 00250 #define SUB 328 00251 #define MUL 329 00252 #define DIV 330 00253 #define REM 331 00254 #define AND 332 00255 #define OR 333 00256 #define XOR 334 00257 #define SETLE 335 00258 #define SETGE 336 00259 #define SETLT 337 00260 #define SETGT 338 00261 #define SETEQ 339 00262 #define SETNE 340 00263 #define MALLOC 341 00264 #define ALLOCA 342 00265 #define FREE 343 00266 #define LOAD 344 00267 #define STORE 345 00268 #define GETELEMENTPTR 346 00269 #define PHI_TOK 347 00270 #define CAST 348 00271 #define SELECT 349 00272 #define SHL 350 00273 #define SHR 351 00274 #define VAARG 352 00275 #define EXTRACTELEMENT 353 00276 #define INSERTELEMENT 354 00277 #define SHUFFLEVECTOR 355 00278 #define VAARG_old 356 00279 #define VANEXT_old 357 00280 00281 00282 00283 00284 /* Copy the first part of user declarations. */ 00285 #line 14 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 00286 00287 #include "ParserInternals.h" 00288 #include "llvm/CallingConv.h" 00289 #include "llvm/InlineAsm.h" 00290 #include "llvm/Instructions.h" 00291 #include "llvm/Module.h" 00292 #include "llvm/SymbolTable.h" 00293 #include "llvm/Assembly/AutoUpgrade.h" 00294 #include "llvm/Support/GetElementPtrTypeIterator.h" 00295 #include "llvm/ADT/STLExtras.h" 00296 #include "llvm/Support/MathExtras.h" 00297 #include <algorithm> 00298 #include <iostream> 00299 #include <list> 00300 #include <utility> 00301 00302 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit 00303 int yylex(); // declaration" of xxx warnings. 00304 int yyparse(); 00305 00306 namespace llvm { 00307 std::string CurFilename; 00308 } 00309 using namespace llvm; 00310 00311 static Module *ParserResult; 00312 00313 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output 00314 // relating to upreferences in the input stream. 00315 // 00316 //#define DEBUG_UPREFS 1 00317 #ifdef DEBUG_UPREFS 00318 #define UR_OUT(X) std::cerr << X 00319 #else 00320 #define UR_OUT(X) 00321 #endif 00322 00323 #define YYERROR_VERBOSE 1 00324 00325 static bool ObsoleteVarArgs; 00326 static bool NewVarArgs; 00327 static BasicBlock *CurBB; 00328 static GlobalVariable *CurGV; 00329 00330 00331 // This contains info used when building the body of a function. It is 00332 // destroyed when the function is completed. 00333 // 00334 typedef std::vector<Value *> ValueList; // Numbered defs 00335 static void 00336 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, 00337 std::map<const Type *,ValueList> *FutureLateResolvers = 0); 00338 00339 static struct PerModuleInfo { 00340 Module *CurrentModule; 00341 std::map<const Type *, ValueList> Values; // Module level numbered definitions 00342 std::map<const Type *,ValueList> LateResolveValues; 00343 std::vector<PATypeHolder> Types; 00344 std::map<ValID, PATypeHolder> LateResolveTypes; 00345 00346 /// PlaceHolderInfo - When temporary placeholder objects are created, remember 00347 /// how they were referenced and on which line of the input they came from so 00348 /// that we can resolve them later and print error messages as appropriate. 00349 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; 00350 00351 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward 00352 // references to global values. Global values may be referenced before they 00353 // are defined, and if so, the temporary object that they represent is held 00354 // here. This is used for forward references of GlobalValues. 00355 // 00356 typedef std::map<std::pair<const PointerType *, 00357 ValID>, GlobalValue*> GlobalRefsType; 00358 GlobalRefsType GlobalRefs; 00359 00360 void ModuleDone() { 00361 // If we could not resolve some functions at function compilation time 00362 // (calls to functions before they are defined), resolve them now... Types 00363 // are resolved when the constant pool has been completely parsed. 00364 // 00365 ResolveDefinitions(LateResolveValues); 00366 00367 // Check to make sure that all global value forward references have been 00368 // resolved! 00369 // 00370 if (!GlobalRefs.empty()) { 00371 std::string UndefinedReferences = "Unresolved global references exist:\n"; 00372 00373 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); 00374 I != E; ++I) { 00375 UndefinedReferences += " " + I->first.first->getDescription() + " " + 00376 I->first.second.getName() + "\n"; 00377 } 00378 ThrowException(UndefinedReferences); 00379 } 00380 00381 // Look for intrinsic functions and CallInst that need to be upgraded 00382 for (Module::iterator FI = CurrentModule->begin(), 00383 FE = CurrentModule->end(); FI != FE; ) 00384 UpgradeCallsToIntrinsic(FI++); 00385 00386 Values.clear(); // Clear out function local definitions 00387 Types.clear(); 00388 CurrentModule = 0; 00389 } 00390 00391 // GetForwardRefForGlobal - Check to see if there is a forward reference 00392 // for this global. If so, remove it from the GlobalRefs map and return it. 00393 // If not, just return null. 00394 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { 00395 // Check to see if there is a forward reference to this global variable... 00396 // if there is, eliminate it and patch the reference to use the new def'n. 00397 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); 00398 GlobalValue *Ret = 0; 00399 if (I != GlobalRefs.end()) { 00400 Ret = I->second; 00401 GlobalRefs.erase(I); 00402 } 00403 return Ret; 00404 } 00405 } CurModule; 00406 00407 static struct PerFunctionInfo { 00408 Function *CurrentFunction; // Pointer to current function being created 00409 00410 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions 00411 std::map<const Type*, ValueList> LateResolveValues; 00412 bool isDeclare; // Is this function a forward declararation? 00413 00414 /// BBForwardRefs - When we see forward references to basic blocks, keep 00415 /// track of them here. 00416 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; 00417 std::vector<BasicBlock*> NumberedBlocks; 00418 unsigned NextBBNum; 00419 00420 inline PerFunctionInfo() { 00421 CurrentFunction = 0; 00422 isDeclare = false; 00423 } 00424 00425 inline void FunctionStart(Function *M) { 00426 CurrentFunction = M; 00427 NextBBNum = 0; 00428 } 00429 00430 void FunctionDone() { 00431 NumberedBlocks.clear(); 00432 00433 // Any forward referenced blocks left? 00434 if (!BBForwardRefs.empty()) 00435 ThrowException("Undefined reference to label " + 00436 BBForwardRefs.begin()->first->getName()); 00437 00438 // Resolve all forward references now. 00439 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); 00440 00441 Values.clear(); // Clear out function local definitions 00442 CurrentFunction = 0; 00443 isDeclare = false; 00444 } 00445 } CurFun; // Info for the current function... 00446 00447 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } 00448 00449 00450 //===----------------------------------------------------------------------===// 00451 // Code to handle definitions of all the types 00452 //===----------------------------------------------------------------------===// 00453 00454 static int InsertValue(Value *V, 00455 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { 00456 if (V->hasName()) return -1; // Is this a numbered definition? 00457 00458 // Yes, insert the value into the value table... 00459 ValueList &List = ValueTab[V->getType()]; 00460 List.push_back(V); 00461 return List.size()-1; 00462 } 00463 00464 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { 00465 switch (D.Type) { 00466 case ValID::NumberVal: // Is it a numbered definition? 00467 // Module constants occupy the lowest numbered slots... 00468 if ((unsigned)D.Num < CurModule.Types.size()) 00469 return CurModule.Types[(unsigned)D.Num]; 00470 break; 00471 case ValID::NameVal: // Is it a named definition? 00472 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { 00473 D.destroy(); // Free old strdup'd memory... 00474 return N; 00475 } 00476 break; 00477 default: 00478 ThrowException("Internal parser error: Invalid symbol type reference!"); 00479 } 00480 00481 // If we reached here, we referenced either a symbol that we don't know about 00482 // or an id number that hasn't been read yet. We may be referencing something 00483 // forward, so just create an entry to be resolved later and get to it... 00484 // 00485 if (DoNotImprovise) return 0; // Do we just want a null to be returned? 00486 00487 00488 if (inFunctionScope()) { 00489 if (D.Type == ValID::NameVal) 00490 ThrowException("Reference to an undefined type: '" + D.getName() + "'"); 00491 else 00492 ThrowException("Reference to an undefined type: #" + itostr(D.Num)); 00493 } 00494 00495 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); 00496 if (I != CurModule.LateResolveTypes.end()) 00497 return I->second; 00498 00499 Type *Typ = OpaqueType::get(); 00500 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); 00501 return Typ; 00502 } 00503 00504 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { 00505 SymbolTable &SymTab = 00506 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : 00507 CurModule.CurrentModule->getSymbolTable(); 00508 return SymTab.lookup(Ty, Name); 00509 } 00510 00511 // getValNonImprovising - Look up the value specified by the provided type and 00512 // the provided ValID. If the value exists and has already been defined, return 00513 // it. Otherwise return null. 00514 // 00515 static Value *getValNonImprovising(const Type *Ty, const ValID &D) { 00516 if (isa<FunctionType>(Ty)) 00517 ThrowException("Functions are not values and " 00518 "must be referenced as pointers"); 00519 00520 switch (D.Type) { 00521 case ValID::NumberVal: { // Is it a numbered definition? 00522 unsigned Num = (unsigned)D.Num; 00523 00524 // Module constants occupy the lowest numbered slots... 00525 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); 00526 if (VI != CurModule.Values.end()) { 00527 if (Num < VI->second.size()) 00528 return VI->second[Num]; 00529 Num -= VI->second.size(); 00530 } 00531 00532 // Make sure that our type is within bounds 00533 VI = CurFun.Values.find(Ty); 00534 if (VI == CurFun.Values.end()) return 0; 00535 00536 // Check that the number is within bounds... 00537 if (VI->second.size() <= Num) return 0; 00538 00539 return VI->second[Num]; 00540 } 00541 00542 case ValID::NameVal: { // Is it a named definition? 00543 Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); 00544 if (N == 0) return 0; 00545 00546 D.destroy(); // Free old strdup'd memory... 00547 return N; 00548 } 00549 00550 // Check to make sure that "Ty" is an integral type, and that our 00551 // value will fit into the specified type... 00552 case ValID::ConstSIntVal: // Is it a constant pool reference?? 00553 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) 00554 ThrowException("Signed integral constant '" + 00555 itostr(D.ConstPool64) + "' is invalid for type '" + 00556 Ty->getDescription() + "'!"); 00557 return ConstantSInt::get(Ty, D.ConstPool64); 00558 00559 case ValID::ConstUIntVal: // Is it an unsigned const pool reference? 00560 if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) { 00561 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { 00562 ThrowException("Integral constant '" + utostr(D.UConstPool64) + 00563 "' is invalid or out of range!"); 00564 } else { // This is really a signed reference. Transmogrify. 00565 return ConstantSInt::get(Ty, D.ConstPool64); 00566 } 00567 } else { 00568 return ConstantUInt::get(Ty, D.UConstPool64); 00569 } 00570 00571 case ValID::ConstFPVal: // Is it a floating point const pool reference? 00572 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) 00573 ThrowException("FP constant invalid for type!!"); 00574 return ConstantFP::get(Ty, D.ConstPoolFP); 00575 00576 case ValID::ConstNullVal: // Is it a null value? 00577 if (!isa<PointerType>(Ty)) 00578 ThrowException("Cannot create a a non pointer null!"); 00579 return ConstantPointerNull::get(cast<PointerType>(Ty)); 00580 00581 case ValID::ConstUndefVal: // Is it an undef value? 00582 return UndefValue::get(Ty); 00583 00584 case ValID::ConstZeroVal: // Is it a zero value? 00585 return Constant::getNullValue(Ty); 00586 00587 case ValID::ConstantVal: // Fully resolved constant? 00588 if (D.ConstantValue->getType() != Ty) 00589 ThrowException("Constant expression type different from required type!"); 00590 return D.ConstantValue; 00591 00592 case ValID::InlineAsmVal: { // Inline asm expression 00593 const PointerType *PTy = dyn_cast<PointerType>(Ty); 00594 const FunctionType *FTy = 00595 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; 00596 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) 00597 ThrowException("Invalid type for asm constraint string!"); 00598 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, 00599 D.IAD->HasSideEffects); 00600 D.destroy(); // Free InlineAsmDescriptor. 00601 return IA; 00602 } 00603 default: 00604 assert(0 && "Unhandled case!"); 00605 return 0; 00606 } // End of switch 00607 00608 assert(0 && "Unhandled case!"); 00609 return 0; 00610 } 00611 00612 // getVal - This function is identical to getValNonImprovising, except that if a 00613 // value is not already defined, it "improvises" by creating a placeholder var 00614 // that looks and acts just like the requested variable. When the value is 00615 // defined later, all uses of the placeholder variable are replaced with the 00616 // real thing. 00617 // 00618 static Value *getVal(const Type *Ty, const ValID &ID) { 00619 if (Ty == Type::LabelTy) 00620 ThrowException("Cannot use a basic block here"); 00621 00622 // See if the value has already been defined. 00623 Value *V = getValNonImprovising(Ty, ID); 00624 if (V) return V; 00625 00626 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) 00627 ThrowException("Invalid use of a composite type!"); 00628 00629 // If we reached here, we referenced either a symbol that we don't know about 00630 // or an id number that hasn't been read yet. We may be referencing something 00631 // forward, so just create an entry to be resolved later and get to it... 00632 // 00633 V = new Argument(Ty); 00634 00635 // Remember where this forward reference came from. FIXME, shouldn't we try 00636 // to recycle these things?? 00637 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, 00638 llvmAsmlineno))); 00639 00640 if (inFunctionScope()) 00641 InsertValue(V, CurFun.LateResolveValues); 00642 else 00643 InsertValue(V, CurModule.LateResolveValues); 00644 return V; 00645 } 00646 00647 /// getBBVal - This is used for two purposes: 00648 /// * If isDefinition is true, a new basic block with the specified ID is being 00649 /// defined. 00650 /// * If isDefinition is true, this is a reference to a basic block, which may 00651 /// or may not be a forward reference. 00652 /// 00653 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { 00654 assert(inFunctionScope() && "Can't get basic block at global scope!"); 00655 00656 std::string Name; 00657 BasicBlock *BB = 0; 00658 switch (ID.Type) { 00659 default: ThrowException("Illegal label reference " + ID.getName()); 00660 case ValID::NumberVal: // Is it a numbered definition? 00661 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) 00662 CurFun.NumberedBlocks.resize(ID.Num+1); 00663 BB = CurFun.NumberedBlocks[ID.Num]; 00664 break; 00665 case ValID::NameVal: // Is it a named definition? 00666 Name = ID.Name; 00667 if (Value *N = CurFun.CurrentFunction-> 00668 getSymbolTable().lookup(Type::LabelTy, Name)) 00669 BB = cast<BasicBlock>(N); 00670 break; 00671 } 00672 00673 // See if the block has already been defined. 00674 if (BB) { 00675 // If this is the definition of the block, make sure the existing value was 00676 // just a forward reference. If it was a forward reference, there will be 00677 // an entry for it in the PlaceHolderInfo map. 00678 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) 00679 // The existing value was a definition, not a forward reference. 00680 ThrowException("Redefinition of label " + ID.getName()); 00681 00682 ID.destroy(); // Free strdup'd memory. 00683 return BB; 00684 } 00685 00686 // Otherwise this block has not been seen before. 00687 BB = new BasicBlock("", CurFun.CurrentFunction); 00688 if (ID.Type == ValID::NameVal) { 00689 BB->setName(ID.Name); 00690 } else { 00691 CurFun.NumberedBlocks[ID.Num] = BB; 00692 } 00693 00694 // If this is not a definition, keep track of it so we can use it as a forward 00695 // reference. 00696 if (!isDefinition) { 00697 // Remember where this forward reference came from. 00698 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); 00699 } else { 00700 // The forward declaration could have been inserted anywhere in the 00701 // function: insert it into the correct place now. 00702 CurFun.CurrentFunction->getBasicBlockList().remove(BB); 00703 CurFun.CurrentFunction->getBasicBlockList().push_back(BB); 00704 } 00705 ID.destroy(); 00706 return BB; 00707 } 00708 00709 00710 //===----------------------------------------------------------------------===// 00711 // Code to handle forward references in instructions 00712 //===----------------------------------------------------------------------===// 00713 // 00714 // This code handles the late binding needed with statements that reference 00715 // values not defined yet... for example, a forward branch, or the PHI node for 00716 // a loop body. 00717 // 00718 // This keeps a table (CurFun.LateResolveValues) of all such forward references 00719 // and back patchs after we are done. 00720 // 00721 00722 // ResolveDefinitions - If we could not resolve some defs at parsing 00723 // time (forward branches, phi functions for loops, etc...) resolve the 00724 // defs now... 00725 // 00726 static void 00727 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, 00728 std::map<const Type*,ValueList> *FutureLateResolvers) { 00729 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved 00730 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), 00731 E = LateResolvers.end(); LRI != E; ++LRI) { 00732 ValueList &List = LRI->second; 00733 while (!List.empty()) { 00734 Value *V = List.back(); 00735 List.pop_back(); 00736 00737 std::map<Value*, std::pair<ValID, int> >::iterator PHI = 00738 CurModule.PlaceHolderInfo.find(V); 00739 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); 00740 00741 ValID &DID = PHI->second.first; 00742 00743 Value *TheRealValue = getValNonImprovising(LRI->first, DID); 00744 if (TheRealValue) { 00745 V->replaceAllUsesWith(TheRealValue); 00746 delete V; 00747 CurModule.PlaceHolderInfo.erase(PHI); 00748 } else if (FutureLateResolvers) { 00749 // Functions have their unresolved items forwarded to the module late 00750 // resolver table 00751 InsertValue(V, *FutureLateResolvers); 00752 } else { 00753 if (DID.Type == ValID::NameVal) 00754 ThrowException("Reference to an invalid definition: '" +DID.getName()+ 00755 "' of type '" + V->getType()->getDescription() + "'", 00756 PHI->second.second); 00757 else 00758 ThrowException("Reference to an invalid definition: #" + 00759 itostr(DID.Num) + " of type '" + 00760 V->getType()->getDescription() + "'", 00761 PHI->second.second); 00762 } 00763 } 00764 } 00765 00766 LateResolvers.clear(); 00767 } 00768 00769 // ResolveTypeTo - A brand new type was just declared. This means that (if 00770 // name is not null) things referencing Name can be resolved. Otherwise, things 00771 // refering to the number can be resolved. Do this now. 00772 // 00773 static void ResolveTypeTo(char *Name, const Type *ToTy) { 00774 ValID D; 00775 if (Name) D = ValID::create(Name); 00776 else D = ValID::create((int)CurModule.Types.size()); 00777 00778 std::map<ValID, PATypeHolder>::iterator I = 00779 CurModule.LateResolveTypes.find(D); 00780 if (I != CurModule.LateResolveTypes.end()) { 00781 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); 00782 CurModule.LateResolveTypes.erase(I); 00783 } 00784 } 00785 00786 // setValueName - Set the specified value to the name given. The name may be 00787 // null potentially, in which case this is a noop. The string passed in is 00788 // assumed to be a malloc'd string buffer, and is free'd by this function. 00789 // 00790 static void setValueName(Value *V, char *NameStr) { 00791 if (NameStr) { 00792 std::string Name(NameStr); // Copy string 00793 free(NameStr); // Free old string 00794 00795 if (V->getType() == Type::VoidTy) 00796 ThrowException("Can't assign name '" + Name+"' to value with void type!"); 00797 00798 assert(inFunctionScope() && "Must be in function scope!"); 00799 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); 00800 if (ST.lookup(V->getType(), Name)) 00801 ThrowException("Redefinition of value named '" + Name + "' in the '" + 00802 V->getType()->getDescription() + "' type plane!"); 00803 00804 // Set the name. 00805 V->setName(Name); 00806 } 00807 } 00808 00809 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, 00810 /// this is a declaration, otherwise it is a definition. 00811 static GlobalVariable * 00812 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, 00813 bool isConstantGlobal, const Type *Ty, 00814 Constant *Initializer) { 00815 if (isa<FunctionType>(Ty)) 00816 ThrowException("Cannot declare global vars of function type!"); 00817 00818 const PointerType *PTy = PointerType::get(Ty); 00819 00820 std::string Name; 00821 if (NameStr) { 00822 Name = NameStr; // Copy string 00823 free(NameStr); // Free old string 00824 } 00825 00826 // See if this global value was forward referenced. If so, recycle the 00827 // object. 00828 ValID ID; 00829 if (!Name.empty()) { 00830 ID = ValID::create((char*)Name.c_str()); 00831 } else { 00832 ID = ValID::create((int)CurModule.Values[PTy].size()); 00833 } 00834 00835 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { 00836 // Move the global to the end of the list, from whereever it was 00837 // previously inserted. 00838 GlobalVariable *GV = cast<GlobalVariable>(FWGV); 00839 CurModule.CurrentModule->getGlobalList().remove(GV); 00840 CurModule.CurrentModule->getGlobalList().push_back(GV); 00841 GV->setInitializer(Initializer); 00842 GV->setLinkage(Linkage); 00843 GV->setConstant(isConstantGlobal); 00844 InsertValue(GV, CurModule.Values); 00845 return GV; 00846 } 00847 00848 // If this global has a name, check to see if there is already a definition 00849 // of this global in the module. If so, merge as appropriate. Note that 00850 // this is really just a hack around problems in the CFE. :( 00851 if (!Name.empty()) { 00852 // We are a simple redefinition of a value, check to see if it is defined 00853 // the same as the old one. 00854 if (GlobalVariable *EGV = 00855 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { 00856 // We are allowed to redefine a global variable in two circumstances: 00857 // 1. If at least one of the globals is uninitialized or 00858 // 2. If both initializers have the same value. 00859 // 00860 if (!EGV->hasInitializer() || !Initializer || 00861 EGV->getInitializer() == Initializer) { 00862 00863 // Make sure the existing global version gets the initializer! Make 00864 // sure that it also gets marked const if the new version is. 00865 if (Initializer && !EGV->hasInitializer()) 00866 EGV->setInitializer(Initializer); 00867 if (isConstantGlobal) 00868 EGV->setConstant(true); 00869 EGV->setLinkage(Linkage); 00870 return EGV; 00871 } 00872 00873 ThrowException("Redefinition of global variable named '" + Name + 00874 "' in the '" + Ty->getDescription() + "' type plane!"); 00875 } 00876 } 00877 00878 // Otherwise there is no existing GV to use, create one now. 00879 GlobalVariable *GV = 00880 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, 00881 CurModule.CurrentModule); 00882 InsertValue(GV, CurModule.Values); 00883 return GV; 00884 } 00885 00886 // setTypeName - Set the specified type to the name given. The name may be 00887 // null potentially, in which case this is a noop. The string passed in is 00888 // assumed to be a malloc'd string buffer, and is freed by this function. 00889 // 00890 // This function returns true if the type has already been defined, but is 00891 // allowed to be redefined in the specified context. If the name is a new name 00892 // for the type plane, it is inserted and false is returned. 00893 static bool setTypeName(const Type *T, char *NameStr) { 00894 assert(!inFunctionScope() && "Can't give types function-local names!"); 00895 if (NameStr == 0) return false; 00896 00897 std::string Name(NameStr); // Copy string 00898 free(NameStr); // Free old string 00899 00900 // We don't allow assigning names to void type 00901 if (T == Type::VoidTy) 00902 ThrowException("Can't assign name '" + Name + "' to the void type!"); 00903 00904 // Set the type name, checking for conflicts as we do so. 00905 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); 00906 00907 if (AlreadyExists) { // Inserting a name that is already defined??? 00908 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); 00909 assert(Existing && "Conflict but no matching type?"); 00910 00911 // There is only one case where this is allowed: when we are refining an 00912 // opaque type. In this case, Existing will be an opaque type. 00913 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { 00914 // We ARE replacing an opaque type! 00915 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); 00916 return true; 00917 } 00918 00919 // Otherwise, this is an attempt to redefine a type. That's okay if 00920 // the redefinition is identical to the original. This will be so if 00921 // Existing and T point to the same Type object. In this one case we 00922 // allow the equivalent redefinition. 00923 if (Existing == T) return true; // Yes, it's equal. 00924 00925 // Any other kind of (non-equivalent) redefinition is an error. 00926 ThrowException("Redefinition of type named '" + Name + "' in the '" + 00927 T->getDescription() + "' type plane!"); 00928 } 00929 00930 return false; 00931 } 00932 00933 //===----------------------------------------------------------------------===// 00934 // Code for handling upreferences in type names... 00935 // 00936 00937 // TypeContains - Returns true if Ty directly contains E in it. 00938 // 00939 static bool TypeContains(const Type *Ty, const Type *E) { 00940 return std::find(Ty->subtype_begin(), Ty->subtype_end(), 00941 E) != Ty->subtype_end(); 00942 } 00943 00944 namespace { 00945 struct UpRefRecord { 00946 // NestingLevel - The number of nesting levels that need to be popped before 00947 // this type is resolved. 00948 unsigned NestingLevel; 00949 00950 // LastContainedTy - This is the type at the current binding level for the 00951 // type. Every time we reduce the nesting level, this gets updated. 00952 const Type *LastContainedTy; 00953 00954 // UpRefTy - This is the actual opaque type that the upreference is 00955 // represented with. 00956 OpaqueType *UpRefTy; 00957 00958 UpRefRecord(unsigned NL, OpaqueType *URTy) 00959 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} 00960 }; 00961 } 00962 00963 // UpRefs - A list of the outstanding upreferences that need to be resolved. 00964 static std::vector<UpRefRecord> UpRefs; 00965 00966 /// HandleUpRefs - Every time we finish a new layer of types, this function is 00967 /// called. It loops through the UpRefs vector, which is a list of the 00968 /// currently active types. For each type, if the up reference is contained in 00969 /// the newly completed type, we decrement the level count. When the level 00970 /// count reaches zero, the upreferenced type is the type that is passed in: 00971 /// thus we can complete the cycle. 00972 /// 00973 static PATypeHolder HandleUpRefs(const Type *ty) { 00974 if (!ty->isAbstract()) return ty; 00975 PATypeHolder Ty(ty); 00976 UR_OUT("Type '" << Ty->getDescription() << 00977 "' newly formed. Resolving upreferences.\n" << 00978 UpRefs.size() << " upreferences active!\n"); 00979 00980 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes 00981 // to zero), we resolve them all together before we resolve them to Ty. At 00982 // the end of the loop, if there is anything to resolve to Ty, it will be in 00983 // this variable. 00984 OpaqueType *TypeToResolve = 0; 00985 00986 for (unsigned i = 0; i != UpRefs.size(); ++i) { 00987 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " 00988 << UpRefs[i].second->getDescription() << ") = " 00989 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); 00990 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { 00991 // Decrement level of upreference 00992 unsigned Level = --UpRefs[i].NestingLevel; 00993 UpRefs[i].LastContainedTy = Ty; 00994 UR_OUT(" Uplevel Ref Level = " << Level << "\n"); 00995 if (Level == 0) { // Upreference should be resolved! 00996 if (!TypeToResolve) { 00997 TypeToResolve = UpRefs[i].UpRefTy; 00998 } else { 00999 UR_OUT(" * Resolving upreference for " 01000 << UpRefs[i].second->getDescription() << "\n"; 01001 std::string OldName = UpRefs[i].UpRefTy->getDescription()); 01002 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); 01003 UR_OUT(" * Type '" << OldName << "' refined upreference to: " 01004 << (const void*)Ty << ", " << Ty->getDescription() << "\n"); 01005 } 01006 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... 01007 --i; // Do not skip the next element... 01008 } 01009 } 01010 } 01011 01012 if (TypeToResolve) { 01013 UR_OUT(" * Resolving upreference for " 01014 << UpRefs[i].second->getDescription() << "\n"; 01015 std::string OldName = TypeToResolve->getDescription()); 01016 TypeToResolve->refineAbstractTypeTo(Ty); 01017 } 01018 01019 return Ty; 01020 } 01021 01022 01023 // common code from the two 'RunVMAsmParser' functions 01024 static Module * RunParser(Module * M) { 01025 01026 llvmAsmlineno = 1; // Reset the current line number... 01027 ObsoleteVarArgs = false; 01028 NewVarArgs = false; 01029 01030 CurModule.CurrentModule = M; 01031 yyparse(); // Parse the file, potentially throwing exception 01032 01033 Module *Result = ParserResult; 01034 ParserResult = 0; 01035 01036 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs 01037 { 01038 Function* F; 01039 if ((F = Result->getNamedFunction("llvm.va_start")) 01040 && F->getFunctionType()->getNumParams() == 0) 01041 ObsoleteVarArgs = true; 01042 if((F = Result->getNamedFunction("llvm.va_copy")) 01043 && F->getFunctionType()->getNumParams() == 1) 01044 ObsoleteVarArgs = true; 01045 } 01046 01047 if (ObsoleteVarArgs && NewVarArgs) 01048 ThrowException("This file is corrupt: it uses both new and old style varargs"); 01049 01050 if(ObsoleteVarArgs) { 01051 if(Function* F = Result->getNamedFunction("llvm.va_start")) { 01052 if (F->arg_size() != 0) 01053 ThrowException("Obsolete va_start takes 0 argument!"); 01054 01055 //foo = va_start() 01056 // -> 01057 //bar = alloca typeof(foo) 01058 //va_start(bar) 01059 //foo = load bar 01060 01061 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); 01062 const Type* ArgTy = F->getFunctionType()->getReturnType(); 01063 const Type* ArgTyPtr = PointerType::get(ArgTy); 01064 Function* NF = Result->getOrInsertFunction("llvm.va_start", 01065 RetTy, ArgTyPtr, (Type *)0); 01066 01067 while (!F->use_empty()) { 01068 CallInst* CI = cast<CallInst>(F->use_back()); 01069 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); 01070 new CallInst(NF, bar, "", CI); 01071 Value* foo = new LoadInst(bar, "vastart.fix.2", CI); 01072 CI->replaceAllUsesWith(foo); 01073 CI->getParent()->getInstList().erase(CI); 01074 } 01075 Result->getFunctionList().erase(F); 01076 } 01077 01078 if(Function* F = Result->getNamedFunction("llvm.va_end")) { 01079 if(F->arg_size() != 1) 01080 ThrowException("Obsolete va_end takes 1 argument!"); 01081 01082 //vaend foo 01083 // -> 01084 //bar = alloca 1 of typeof(foo) 01085 //vaend bar 01086 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); 01087 const Type* ArgTy = F->getFunctionType()->getParamType(0); 01088 const Type* ArgTyPtr = PointerType::get(ArgTy); 01089 Function* NF = Result->getOrInsertFunction("llvm.va_end", 01090 RetTy, ArgTyPtr, (Type *)0); 01091 01092 while (!F->use_empty()) { 01093 CallInst* CI = cast<CallInst>(F->use_back()); 01094 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); 01095 new StoreInst(CI->getOperand(1), bar, CI); 01096 new CallInst(NF, bar, "", CI); 01097 CI->getParent()->getInstList().erase(CI); 01098 } 01099 Result->getFunctionList().erase(F); 01100 } 01101 01102 if(Function* F = Result->getNamedFunction("llvm.va_copy")) { 01103 if(F->arg_size() != 1) 01104 ThrowException("Obsolete va_copy takes 1 argument!"); 01105 //foo = vacopy(bar) 01106 // -> 01107 //a = alloca 1 of typeof(foo) 01108 //b = alloca 1 of typeof(foo) 01109 //store bar -> b 01110 //vacopy(a, b) 01111 //foo = load a 01112 01113 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); 01114 const Type* ArgTy = F->getFunctionType()->getReturnType(); 01115 const Type* ArgTyPtr = PointerType::get(ArgTy); 01116 Function* NF = Result->getOrInsertFunction("llvm.va_copy", 01117 RetTy, ArgTyPtr, ArgTyPtr, 01118 (Type *)0); 01119 01120 while (!F->use_empty()) { 01121 CallInst* CI = cast<CallInst>(F->use_back()); 01122 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); 01123 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); 01124 new StoreInst(CI->getOperand(1), b, CI); 01125 new CallInst(NF, a, b, "", CI); 01126 Value* foo = new LoadInst(a, "vacopy.fix.3", CI); 01127 CI->replaceAllUsesWith(foo); 01128 CI->getParent()->getInstList().erase(CI); 01129 } 01130 Result->getFunctionList().erase(F); 01131 } 01132 } 01133 01134 return Result; 01135 01136 } 01137 01138 //===----------------------------------------------------------------------===// 01139 // RunVMAsmParser - Define an interface to this parser 01140 //===----------------------------------------------------------------------===// 01141 // 01142 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { 01143 set_scan_file(F); 01144 01145 CurFilename = Filename; 01146 return RunParser(new Module(CurFilename)); 01147 } 01148 01149 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { 01150 set_scan_string(AsmString); 01151 01152 CurFilename = "from_memory"; 01153 if (M == NULL) { 01154 return RunParser(new Module (CurFilename)); 01155 } else { 01156 return RunParser(M); 01157 } 01158 } 01159 01160 01161 01162 /* Enabling traces. */ 01163 #ifndef YYDEBUG 01164 # define YYDEBUG 0 01165 #endif 01166 01167 /* Enabling verbose error messages. */ 01168 #ifdef YYERROR_VERBOSE 01169 # undef YYERROR_VERBOSE 01170 # define YYERROR_VERBOSE 1 01171 #else 01172 # define YYERROR_VERBOSE 0 01173 #endif 01174 01175 /* Enabling the token table. */ 01176 #ifndef YYTOKEN_TABLE 01177 # define YYTOKEN_TABLE 0 01178 #endif 01179 01180 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 01181 typedef union YYSTYPE 01182 #line 890 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 01183 { 01184 llvm::Module *ModuleVal; 01185 llvm::Function *FunctionVal; 01186 std::pair<llvm::PATypeHolder*, char*> *ArgVal; 01187 llvm::BasicBlock *BasicBlockVal; 01188 llvm::TerminatorInst *TermInstVal; 01189 llvm::Instruction *InstVal; 01190 llvm::Constant *ConstVal; 01191 01192 const llvm::Type *PrimType; 01193 llvm::PATypeHolder *TypeVal; 01194 llvm::Value *ValueVal; 01195 01196 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList; 01197 std::vector<llvm::Value*> *ValueList; 01198 std::list<llvm::PATypeHolder> *TypeList; 01199 // Represent the RHS of PHI node 01200 std::list<std::pair<llvm::Value*, 01201 llvm::BasicBlock*> > *PHIList; 01202 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; 01203 std::vector<llvm::Constant*> *ConstVector; 01204 01205 llvm::GlobalValue::LinkageTypes Linkage; 01206 int64_t SInt64Val; 01207 uint64_t UInt64Val; 01208 int SIntVal; 01209 unsigned UIntVal; 01210 double FPVal; 01211 bool BoolVal; 01212 01213 char *StrVal; // This memory is strdup'd! 01214 llvm::ValID ValIDVal; // strdup'd memory maybe! 01215 01216 llvm::Instruction::BinaryOps BinaryOpVal; 01217 llvm::Instruction::TermOps TermOpVal; 01218 llvm::Instruction::MemoryOps MemOpVal; 01219 llvm::Instruction::OtherOps OtherOpVal; 01220 llvm::Module::Endianness Endianness; 01221 } 01222 /* Line 193 of yacc.c. */ 01223 #line 1224 "llvmAsmParser.tab.c" 01224 YYSTYPE; 01225 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 01226 # define YYSTYPE_IS_DECLARED 1 01227 # define YYSTYPE_IS_TRIVIAL 1 01228 #endif 01229 01230 01231 01232 /* Copy the second part of user declarations. */ 01233 01234 01235 /* Line 216 of yacc.c. */ 01236 #line 1237 "llvmAsmParser.tab.c" 01237 01238 #ifdef short 01239 # undef short 01240 #endif 01241 01242 #ifdef YYTYPE_UINT8 01243 typedef YYTYPE_UINT8 yytype_uint8; 01244 #else 01245 typedef unsigned char yytype_uint8; 01246 #endif 01247 01248 #ifdef YYTYPE_INT8 01249 typedef YYTYPE_INT8 yytype_int8; 01250 #elif (defined __STDC__ || defined __C99__FUNC__ \ 01251 || defined __cplusplus || defined _MSC_VER) 01252 typedef signed char yytype_int8; 01253 #else 01254 typedef short int yytype_int8; 01255 #endif 01256 01257 #ifdef YYTYPE_UINT16 01258 typedef YYTYPE_UINT16 yytype_uint16; 01259 #else 01260 typedef unsigned short int yytype_uint16; 01261 #endif 01262 01263 #ifdef YYTYPE_INT16 01264 typedef YYTYPE_INT16 yytype_int16; 01265 #else 01266 typedef short int yytype_int16; 01267 #endif 01268 01269 #ifndef YYSIZE_T 01270 # ifdef __SIZE_TYPE__ 01271 # define YYSIZE_T __SIZE_TYPE__ 01272 # elif defined size_t 01273 # define YYSIZE_T size_t 01274 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 01275 || defined __cplusplus || defined _MSC_VER) 01276 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 01277 # define YYSIZE_T size_t 01278 # else 01279 # define YYSIZE_T unsigned int 01280 # endif 01281 #endif 01282 01283 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 01284 01285 #ifndef YY_ 01286 # if YYENABLE_NLS 01287 # if ENABLE_NLS 01288 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 01289 # define YY_(msgid) dgettext ("bison-runtime", msgid) 01290 # endif 01291 # endif 01292 # ifndef YY_ 01293 # define YY_(msgid) msgid 01294 # endif 01295 #endif 01296 01297 /* Suppress unused-variable warnings by "using" E. */ 01298 #if ! defined lint || defined __GNUC__ 01299 # define YYUSE(e) ((void) (e)) 01300 #else 01301 # define YYUSE(e) /* empty */ 01302 #endif 01303 01304 /* Identity function, used to suppress warnings about constant conditions. */ 01305 #ifndef lint 01306 # define YYID(n) (n) 01307 #else 01308 #if (defined __STDC__ || defined __C99__FUNC__ \ 01309 || defined __cplusplus || defined _MSC_VER) 01310 static int 01311 YYID (int i) 01312 #else 01313 static int 01314 YYID (i) 01315 int i; 01316 #endif 01317 { 01318 return i; 01319 } 01320 #endif 01321 01322 #if ! defined yyoverflow || YYERROR_VERBOSE 01323 01324 /* The parser invokes alloca or malloc; define the necessary symbols. */ 01325 01326 # ifdef YYSTACK_USE_ALLOCA 01327 # if YYSTACK_USE_ALLOCA 01328 # ifdef __GNUC__ 01329 # define YYSTACK_ALLOC __builtin_alloca 01330 # elif defined __BUILTIN_VA_ARG_INCR 01331 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 01332 # elif defined _AIX 01333 # define YYSTACK_ALLOC __alloca 01334 # elif defined _MSC_VER 01335 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 01336 # define alloca _alloca 01337 # else 01338 # define YYSTACK_ALLOC alloca 01339 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 01340 || defined __cplusplus || defined _MSC_VER) 01341 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 01342 # ifndef _STDLIB_H 01343 # define _STDLIB_H 1 01344 # endif 01345 # endif 01346 # endif 01347 # endif 01348 # endif 01349 01350 # ifdef YYSTACK_ALLOC 01351 /* Pacify GCC's `empty if-body' warning. */ 01352 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 01353 # ifndef YYSTACK_ALLOC_MAXIMUM 01354 /* The OS might guarantee only one guard page at the bottom of the stack, 01355 and a page size can be as small as 4096 bytes. So we cannot safely 01356 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 01357 to allow for a few compiler-allocated temporary stack slots. */ 01358 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 01359 # endif 01360 # else 01361 # define YYSTACK_ALLOC YYMALLOC 01362 # define YYSTACK_FREE YYFREE 01363 # ifndef YYSTACK_ALLOC_MAXIMUM 01364 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 01365 # endif 01366 # if (defined __cplusplus && ! defined _STDLIB_H \ 01367 && ! ((defined YYMALLOC || defined malloc) \ 01368 && (defined YYFREE || defined free))) 01369 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 01370 # ifndef _STDLIB_H 01371 # define _STDLIB_H 1 01372 # endif 01373 # endif 01374 # ifndef YYMALLOC 01375 # define YYMALLOC malloc 01376 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 01377 || defined __cplusplus || defined _MSC_VER) 01378 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 01379 # endif 01380 # endif 01381 # ifndef YYFREE 01382 # define YYFREE free 01383 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 01384 || defined __cplusplus || defined _MSC_VER) 01385 void free (void *); /* INFRINGES ON USER NAME SPACE */ 01386 # endif 01387 # endif 01388 # endif 01389 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 01390 01391 01392 #if (! defined yyoverflow \ 01393 && (! defined __cplusplus \ 01394 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 01395 01396 /* A type that is properly aligned for any stack member. */ 01397 union yyalloc 01398 { 01399 yytype_int16 yyss; 01400 YYSTYPE yyvs; 01401 }; 01402 01403 /* The size of the maximum gap between one aligned stack and the next. */ 01404 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 01405 01406 /* The size of an array large to enough to hold all stacks, each with 01407 N elements. */ 01408 # define YYSTACK_BYTES(N) \ 01409 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 01410 + YYSTACK_GAP_MAXIMUM) 01411 01412 /* Copy COUNT objects from FROM to TO. The source and destination do 01413 not overlap. */ 01414 # ifndef YYCOPY 01415 # if defined __GNUC__ && 1 < __GNUC__ 01416 # define YYCOPY(To, From, Count) \ 01417 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 01418 # else 01419 # define YYCOPY(To, From, Count) \ 01420 do \ 01421 { \ 01422 YYSIZE_T yyi; \ 01423 for (yyi = 0; yyi < (Count); yyi++) \ 01424 (To)[yyi] = (From)[yyi]; \ 01425 } \ 01426 while (YYID (0)) 01427 # endif 01428 # endif 01429 01430 /* Relocate STACK from its old location to the new one. The 01431 local variables YYSIZE and YYSTACKSIZE give the old and new number of 01432 elements in the stack, and YYPTR gives the new location of the 01433 stack. Advance YYPTR to a properly aligned location for the next 01434 stack. */ 01435 # define YYSTACK_RELOCATE(Stack) \ 01436 do \ 01437 { \ 01438 YYSIZE_T yynewbytes; \ 01439 YYCOPY (&yyptr->Stack, Stack, yysize); \ 01440 Stack = &yyptr->Stack; \ 01441 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 01442 yyptr += yynewbytes / sizeof (*yyptr); \ 01443 } \ 01444 while (YYID (0)) 01445 01446 #endif 01447 01448 /* YYFINAL -- State number of the termination state. */ 01449 #define YYFINAL 4 01450 /* YYLAST -- Last index in YYTABLE. */ 01451 #define YYLAST 1278 01452 01453 /* YYNTOKENS -- Number of terminals. */ 01454 #define YYNTOKENS 117 01455 /* YYNNTS -- Number of nonterminals. */ 01456 #define YYNNTS 72 01457 /* YYNRULES -- Number of rules. */ 01458 #define YYNRULES 239 01459 /* YYNRULES -- Number of states. */ 01460 #define YYNSTATES 496 01461 01462 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 01463 #define YYUNDEFTOK 2 01464 #define YYMAXUTOK 357 01465 01466 #define YYTRANSLATE(YYX) \ 01467 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 01468 01469 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 01470 static const yytype_uint8 yytranslate[] = 01471 { 01472 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01476 106, 107, 115, 2, 104, 2, 2, 2, 2, 2, 01477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01478 111, 103, 112, 2, 2, 2, 2, 2, 2, 2, 01479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01481 2, 108, 105, 110, 2, 2, 2, 2, 2, 116, 01482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01484 109, 2, 2, 113, 2, 114, 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, 2, 2, 2, 2, 01496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 01497 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 01498 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 01499 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 01500 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 01501 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 01502 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 01503 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 01504 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 01505 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 01506 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 01507 95, 96, 97, 98, 99, 100, 101, 102 01508 }; 01509 01510 #if YYDEBUG 01511 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 01512 YYRHS. */ 01513 static const yytype_uint16 yyprhs[] = 01514 { 01515 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 01516 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 01517 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 01518 59, 61, 63, 65, 67, 70, 71, 73, 75, 77, 01519 79, 80, 81, 83, 85, 87, 89, 92, 93, 96, 01520 97, 101, 104, 105, 107, 108, 112, 114, 117, 119, 01521 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 01522 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 01523 162, 167, 173, 179, 183, 186, 189, 191, 195, 197, 01524 201, 203, 204, 209, 213, 217, 222, 227, 231, 234, 01525 237, 240, 243, 246, 249, 252, 255, 258, 261, 268, 01526 274, 283, 290, 297, 304, 311, 318, 327, 336, 340, 01527 342, 344, 346, 348, 351, 354, 359, 362, 364, 369, 01528 372, 377, 378, 386, 387, 395, 399, 404, 405, 407, 01529 409, 411, 415, 419, 423, 427, 431, 433, 434, 436, 01530 438, 440, 441, 444, 448, 450, 452, 456, 458, 459, 01531 468, 470, 472, 476, 478, 480, 483, 484, 488, 489, 01532 491, 493, 495, 497, 499, 501, 503, 505, 507, 511, 01533 513, 519, 521, 523, 525, 527, 530, 533, 536, 540, 01534 543, 544, 546, 549, 552, 556, 566, 576, 585, 599, 01535 601, 603, 610, 616, 619, 626, 634, 636, 640, 642, 01536 643, 646, 648, 654, 660, 666, 669, 674, 679, 686, 01537 691, 696, 701, 706, 713, 720, 723, 731, 733, 736, 01538 737, 739, 740, 744, 751, 755, 762, 765, 770, 777 01539 }; 01540 01541 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 01542 static const yytype_int16 yyrhs[] = 01543 { 01544 148, 0, -1, 5, -1, 6, -1, 3, -1, 4, 01545 -1, 72, -1, 73, -1, 74, -1, 75, -1, 76, 01546 -1, 77, -1, 78, -1, 79, -1, 80, -1, 81, 01547 -1, 82, -1, 83, -1, 84, -1, 85, -1, 95, 01548 -1, 96, -1, 16, -1, 14, -1, 12, -1, 10, 01549 -1, 17, -1, 15, -1, 13, -1, 11, -1, 124, 01550 -1, 125, -1, 18, -1, 19, -1, 158, 103, -1, 01551 -1, 41, -1, 42, -1, 43, -1, 44, -1, -1, 01552 -1, 62, -1, 63, -1, 64, -1, 65, -1, 61, 01553 4, -1, -1, 54, 4, -1, -1, 104, 54, 4, 01554 -1, 34, 24, -1, -1, 133, -1, -1, 104, 136, 01555 135, -1, 133, -1, 54, 4, -1, 139, -1, 8, 01556 -1, 141, -1, 8, -1, 141, -1, 9, -1, 10, 01557 -1, 11, -1, 12, -1, 13, -1, 14, -1, 15, 01558 -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, 01559 -1, 21, -1, 45, -1, 140, -1, 172, -1, 105, 01560 4, -1, 138, 106, 143, 107, -1, 108, 4, 109, 01561 141, 110, -1, 111, 4, 109, 141, 112, -1, 113, 01562 142, 114, -1, 113, 114, -1, 141, 115, -1, 141, 01563 -1, 142, 104, 141, -1, 142, -1, 142, 104, 37, 01564 -1, 37, -1, -1, 139, 108, 146, 110, -1, 139, 01565 108, 110, -1, 139, 116, 24, -1, 139, 111, 146, 01566 112, -1, 139, 113, 146, 114, -1, 139, 113, 114, 01567 -1, 139, 38, -1, 139, 39, -1, 139, 172, -1, 01568 139, 145, -1, 139, 26, -1, 124, 119, -1, 125, 01569 4, -1, 9, 27, -1, 9, 28, -1, 127, 7, 01570 -1, 93, 106, 144, 36, 139, 107, -1, 91, 106, 01571 144, 186, 107, -1, 94, 106, 144, 104, 144, 104, 01572 144, 107, -1, 120, 106, 144, 104, 144, 107, -1, 01573 121, 106, 144, 104, 144, 107, -1, 122, 106, 144, 01574 104, 144, 107, -1, 123, 106, 144, 104, 144, 107, 01575 -1, 98, 106, 144, 104, 144, 107, -1, 99, 106, 01576 144, 104, 144, 104, 144, 107, -1, 100, 106, 144, 01577 104, 144, 104, 144, 107, -1, 146, 104, 144, -1, 01578 144, -1, 32, -1, 33, -1, 149, -1, 149, 167, 01579 -1, 149, 168, -1, 149, 59, 58, 153, -1, 149, 01580 25, -1, 150, -1, 150, 128, 20, 137, -1, 150, 01581 168, -1, 150, 59, 58, 153, -1, -1, 150, 128, 01582 129, 147, 144, 151, 135, -1, -1, 150, 128, 47, 01583 147, 139, 152, 135, -1, 150, 48, 155, -1, 150, 01584 55, 103, 156, -1, -1, 24, -1, 53, -1, 52, 01585 -1, 50, 103, 154, -1, 51, 103, 4, -1, 49, 01586 103, 24, -1, 108, 157, 110, -1, 157, 104, 24, 01587 -1, 24, -1, -1, 22, -1, 24, -1, 158, -1, 01588 -1, 139, 159, -1, 161, 104, 160, -1, 160, -1, 01589 161, -1, 161, 104, 37, -1, 37, -1, -1, 130, 01590 137, 158, 106, 162, 107, 134, 131, -1, 29, -1, 01591 113, -1, 129, 163, 164, -1, 30, -1, 114, -1, 01592 175, 166, -1, -1, 31, 169, 163, -1, -1, 60, 01593 -1, 3, -1, 4, -1, 7, -1, 27, -1, 28, 01594 -1, 38, -1, 39, -1, 26, -1, 111, 146, 112, 01595 -1, 145, -1, 58, 170, 24, 104, 24, -1, 118, 01596 -1, 158, -1, 172, -1, 171, -1, 139, 173, -1, 01597 175, 176, -1, 165, 176, -1, 177, 128, 178, -1, 01598 177, 180, -1, -1, 23, -1, 66, 174, -1, 66, 01599 8, -1, 67, 21, 173, -1, 67, 9, 173, 104, 01600 21, 173, 104, 21, 173, -1, 68, 126, 173, 104, 01601 21, 173, 108, 179, 110, -1, 68, 126, 173, 104, 01602 21, 173, 108, 110, -1, 69, 130, 137, 173, 106, 01603 183, 107, 36, 21, 173, 70, 21, 173, -1, 70, 01604 -1, 71, -1, 179, 126, 171, 104, 21, 173, -1, 01605 126, 171, 104, 21, 173, -1, 128, 185, -1, 139, 01606 108, 173, 104, 173, 110, -1, 181, 104, 108, 173, 01607 104, 173, 110, -1, 174, -1, 182, 104, 174, -1, 01608 182, -1, -1, 57, 56, -1, 56, -1, 120, 139, 01609 173, 104, 173, -1, 121, 139, 173, 104, 173, -1, 01610 122, 139, 173, 104, 173, -1, 46, 174, -1, 123, 01611 174, 104, 174, -1, 93, 174, 36, 139, -1, 94, 01612 174, 104, 174, 104, 174, -1, 97, 174, 104, 139, 01613 -1, 101, 174, 104, 139, -1, 102, 174, 104, 139, 01614 -1, 98, 174, 104, 174, -1, 99, 174, 104, 174, 01615 104, 174, -1, 100, 174, 104, 174, 104, 174, -1, 01616 92, 181, -1, 184, 130, 137, 173, 106, 183, 107, 01617 -1, 188, -1, 104, 182, -1, -1, 35, -1, -1, 01618 86, 139, 132, -1, 86, 139, 104, 15, 173, 132, 01619 -1, 87, 139, 132, -1, 87, 139, 104, 15, 173, 01620 132, -1, 88, 174, -1, 187, 89, 139, 173, -1, 01621 187, 90, 174, 104, 139, 173, -1, 91, 139, 173, 01622 186, -1 01623 }; 01624 01625 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 01626 static const yytype_uint16 yyrline[] = 01627 { 01628 0, 1010, 1010, 1011, 1018, 1019, 1028, 1028, 1028, 1028, 01629 1028, 1029, 1029, 1029, 1030, 1030, 1030, 1030, 1030, 1030, 01630 1032, 1032, 1036, 1036, 1036, 1036, 1037, 1037, 1037, 1037, 01631 1038, 1038, 1039, 1039, 1042, 1045, 1049, 1050, 1051, 1052, 01632 1053, 1055, 1056, 1057, 1058, 1059, 1060, 1068, 1069, 1074, 01633 1075, 1082, 1089, 1090, 1095, 1096, 1097, 1101, 1114, 1114, 01634 1115, 1115, 1117, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 01635 1127, 1127, 1127, 1127, 1127, 1127, 1128, 1131, 1134, 1140, 01636 1147, 1159, 1163, 1174, 1183, 1186, 1194, 1198, 1203, 1204, 01637 1207, 1210, 1220, 1245, 1258, 1287, 1312, 1332, 1344, 1353, 01638 1357, 1416, 1422, 1430, 1435, 1440, 1443, 1446, 1453, 1463, 01639 1494, 1501, 1522, 1532, 1537, 1544, 1549, 1554, 1562, 1565, 01640 1572, 1572, 1582, 1589, 1593, 1596, 1599, 1602, 1615, 1635, 01641 1637, 1639, 1639, 1645, 1645, 1652, 1654, 1656, 1660, 1672, 01642 1673, 1675, 1678, 1686, 1691, 1693, 1697, 1701, 1709, 1709, 01643 1710, 1710, 1712, 1718, 1723, 1729, 1732, 1737, 1741, 1745, 01644 1831, 1831, 1833, 1841, 1841, 1843, 1847, 1847, 1856, 1859, 01645 1863, 1866, 1869, 1872, 1875, 1878, 1881, 1884, 1887, 1911, 01646 1914, 1927, 1930, 1935, 1935, 1941, 1945, 1948, 1956, 1965, 01647 1969, 1979, 1990, 1993, 1996, 1999, 2002, 2016, 2020, 2073, 01648 2076, 2082, 2090, 2100, 2107, 2112, 2119, 2123, 2129, 2129, 01649 2131, 2134, 2140, 2152, 2163, 2173, 2185, 2192, 2199, 2206, 01650 2211, 2230, 2252, 2257, 2262, 2267, 2281, 2338, 2344, 2346, 01651 2350, 2353, 2359, 2363, 2367, 2371, 2375, 2382, 2392, 2405 01652 }; 01653 #endif 01654 01655 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 01656 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 01657 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 01658 static const char *const yytname[] = 01659 { 01660 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", 01661 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", 01662 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", 01663 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", 01664 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", 01665 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", 01666 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", 01667 "WEAK", "APPENDING", "OPAQUE", "NOT", "EXTERNAL", "TARGET", "TRIPLE", 01668 "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS", "CALL", 01669 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", 01670 "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "RET", "BR", "SWITCH", 01671 "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "DIV", "REM", 01672 "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", 01673 "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK", 01674 "CAST", "SELECT", "SHL", "SHR", "VAARG", "EXTRACTELEMENT", 01675 "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='", 01676 "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", 01677 "'}'", "'*'", "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps", 01678 "LogicalOps", "SetCondOps", "ShiftOps", "SIntType", "UIntType", 01679 "IntType", "FPType", "OptAssign", "OptLinkage", "OptCallingConv", 01680 "OptAlign", "OptCAlign", "SectionString", "OptSection", 01681 "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV", 01682 "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", 01683 "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList", 01684 "ConstPool", "@1", "@2", "AsmBlock", "BigOrLittle", "TargetDefinition", 01685 "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", 01686 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", 01687 "END", "Function", "FunctionProto", "@3", "OptSideEffect", 01688 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", 01689 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", 01690 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE", 01691 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0 01692 }; 01693 #endif 01694 01695 # ifdef YYPRINT 01696 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 01697 token YYLEX-NUM. */ 01698 static const yytype_uint16 yytoknum[] = 01699 { 01700 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 01701 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 01702 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 01703 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 01704 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 01705 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 01706 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 01707 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 01708 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 01709 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 01710 355, 356, 357, 61, 44, 92, 40, 41, 91, 120, 01711 93, 60, 62, 123, 125, 42, 99 01712 }; 01713 # endif 01714 01715 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 01716 static const yytype_uint8 yyr1[] = 01717 { 01718 0, 117, 118, 118, 119, 119, 120, 120, 120, 120, 01719 120, 121, 121, 121, 122, 122, 122, 122, 122, 122, 01720 123, 123, 124, 124, 124, 124, 125, 125, 125, 125, 01721 126, 126, 127, 127, 128, 128, 129, 129, 129, 129, 01722 129, 130, 130, 130, 130, 130, 130, 131, 131, 132, 01723 132, 133, 134, 134, 135, 135, 136, 136, 137, 137, 01724 138, 138, 139, 140, 140, 140, 140, 140, 140, 140, 01725 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 01726 141, 141, 141, 141, 141, 141, 142, 142, 143, 143, 01727 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 01728 144, 144, 144, 144, 144, 144, 144, 144, 145, 145, 01729 145, 145, 145, 145, 145, 145, 145, 145, 146, 146, 01730 147, 147, 148, 149, 149, 149, 149, 149, 150, 150, 01731 150, 151, 150, 152, 150, 150, 150, 150, 153, 154, 01732 154, 155, 155, 155, 156, 157, 157, 157, 158, 158, 01733 159, 159, 160, 161, 161, 162, 162, 162, 162, 163, 01734 164, 164, 165, 166, 166, 167, 169, 168, 170, 170, 01735 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 01736 171, 172, 172, 173, 173, 174, 175, 175, 176, 177, 01737 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, 01738 178, 179, 179, 180, 181, 181, 182, 182, 183, 183, 01739 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, 01740 185, 185, 185, 185, 185, 185, 185, 185, 186, 186, 01741 187, 187, 188, 188, 188, 188, 188, 188, 188, 188 01742 }; 01743 01744 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 01745 static const yytype_uint8 yyr2[] = 01746 { 01747 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 01748 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 01749 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 01750 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 01751 0, 0, 1, 1, 1, 1, 2, 0, 2, 0, 01752 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, 01753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 01754 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 01755 4, 5, 5, 3, 2, 2, 1, 3, 1, 3, 01756 1, 0, 4, 3, 3, 4, 4, 3, 2, 2, 01757 2, 2, 2, 2, 2, 2, 2, 2, 6, 5, 01758 8, 6, 6, 6, 6, 6, 8, 8, 3, 1, 01759 1, 1, 1, 2, 2, 4, 2, 1, 4, 2, 01760 4, 0, 7, 0, 7, 3, 4, 0, 1, 1, 01761 1, 3, 3, 3, 3, 3, 1, 0, 1, 1, 01762 1, 0, 2, 3, 1, 1, 3, 1, 0, 8, 01763 1, 1, 3, 1, 1, 2, 0, 3, 0, 1, 01764 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 01765 5, 1, 1, 1, 1, 2, 2, 2, 3, 2, 01766 0, 1, 2, 2, 3, 9, 9, 8, 13, 1, 01767 1, 6, 5, 2, 6, 7, 1, 3, 1, 0, 01768 2, 1, 5, 5, 5, 2, 4, 4, 6, 4, 01769 4, 4, 4, 6, 6, 2, 7, 1, 2, 0, 01770 1, 0, 3, 6, 3, 6, 2, 4, 6, 4 01771 }; 01772 01773 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 01774 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 01775 means the default is an error. */ 01776 static const yytype_uint8 yydefact[] = 01777 { 01778 137, 0, 40, 127, 1, 126, 166, 36, 37, 38, 01779 39, 0, 41, 190, 123, 124, 190, 148, 149, 0, 01780 0, 0, 40, 0, 129, 41, 0, 0, 42, 43, 01781 44, 45, 0, 0, 191, 187, 35, 163, 164, 165, 01782 186, 0, 0, 0, 135, 0, 0, 0, 0, 0, 01783 34, 167, 138, 125, 46, 2, 3, 59, 63, 64, 01784 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 01785 75, 76, 0, 0, 0, 0, 181, 0, 0, 58, 01786 77, 62, 182, 78, 160, 161, 162, 231, 189, 0, 01787 0, 0, 147, 136, 130, 128, 120, 121, 0, 0, 01788 79, 0, 0, 61, 84, 86, 0, 0, 91, 85, 01789 230, 0, 211, 0, 0, 0, 0, 41, 199, 200, 01790 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 01791 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 01792 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, 01793 0, 0, 0, 188, 41, 203, 0, 227, 143, 140, 01794 139, 141, 142, 146, 0, 133, 63, 64, 65, 66, 01795 67, 68, 69, 70, 71, 72, 73, 0, 0, 0, 01796 0, 131, 0, 0, 0, 83, 158, 90, 88, 0, 01797 0, 215, 210, 193, 192, 0, 0, 25, 29, 24, 01798 28, 23, 27, 22, 26, 30, 31, 0, 0, 49, 01799 49, 236, 0, 0, 225, 0, 0, 0, 0, 0, 01800 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01801 0, 144, 54, 105, 106, 4, 5, 103, 104, 107, 01802 102, 98, 99, 0, 0, 0, 0, 0, 0, 0, 01803 0, 0, 0, 0, 0, 0, 0, 101, 100, 54, 01804 60, 60, 87, 157, 151, 154, 155, 0, 0, 80, 01805 170, 171, 172, 177, 173, 174, 175, 176, 168, 0, 01806 179, 184, 183, 185, 0, 194, 0, 0, 0, 232, 01807 0, 234, 229, 0, 0, 0, 0, 0, 0, 0, 01808 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01809 145, 0, 134, 0, 0, 0, 0, 0, 0, 93, 01810 119, 0, 0, 97, 0, 94, 0, 0, 0, 0, 01811 132, 81, 82, 150, 152, 0, 52, 89, 169, 0, 01812 0, 0, 0, 0, 0, 0, 0, 0, 239, 0, 01813 0, 217, 0, 219, 222, 0, 0, 220, 221, 0, 01814 0, 0, 216, 0, 237, 0, 0, 0, 56, 54, 01815 229, 0, 0, 0, 0, 0, 0, 92, 95, 96, 01816 0, 0, 0, 0, 156, 153, 53, 47, 0, 178, 01817 0, 0, 209, 49, 50, 49, 206, 228, 0, 0, 01818 0, 0, 0, 212, 213, 214, 209, 0, 51, 57, 01819 55, 0, 0, 0, 0, 0, 0, 118, 0, 0, 01820 0, 0, 0, 159, 0, 0, 0, 208, 0, 0, 01821 233, 235, 0, 0, 0, 218, 223, 224, 0, 238, 01822 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01823 48, 180, 0, 0, 0, 207, 204, 0, 226, 108, 01824 0, 115, 0, 0, 111, 112, 113, 114, 0, 197, 01825 0, 0, 0, 205, 0, 0, 0, 195, 0, 196, 01826 0, 0, 110, 116, 117, 0, 0, 0, 0, 0, 01827 0, 202, 0, 0, 201, 198 01828 }; 01829 01830 /* YYDEFGOTO[NTERM-NUM]. */ 01831 static const yytype_int16 yydefgoto[] = 01832 { 01833 -1, 76, 237, 253, 254, 255, 256, 177, 178, 207, 01834 179, 22, 12, 32, 423, 289, 368, 387, 312, 369, 01835 77, 78, 180, 80, 81, 106, 189, 320, 280, 321, 01836 98, 1, 2, 3, 259, 232, 53, 161, 44, 93, 01837 164, 82, 334, 265, 266, 267, 33, 86, 13, 39, 01838 14, 15, 25, 339, 281, 83, 283, 396, 16, 35, 01839 36, 153, 471, 88, 214, 427, 428, 154, 155, 348, 01840 156, 157 01841 }; 01842 01843 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 01844 STATE-NUM. */ 01845 #define YYPACT_NINF -442 01846 static const yytype_int16 yypact[] = 01847 { 01848 -442, 25, 181, 372, -442, -442, -442, -442, -442, -442, 01849 -442, -16, 33, 42, -442, -442, -14, -442, -442, 12, 01850 -57, 18, 44, -25, -442, 33, 75, 106, -442, -442, 01851 -442, -442, 1012, -21, -442, -442, 4, -442, -442, -442, 01852 -442, 29, 32, 49, -442, 47, 75, 1012, 97, 97, 01853 -442, -442, -442, -442, -442, -442, -442, 63, -442, -442, 01854 -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, 01855 -442, -442, 170, 171, 173, 524, -442, 4, 72, -442, 01856 -442, -84, -442, -442, -442, -442, -442, 1176, -442, 156, 01857 94, 175, 158, -442, -442, -442, -442, -442, 1050, 1088, 01858 -442, 74, 76, -442, -442, -84, -37, 78, 819, -442, 01859 -442, 1050, -442, 131, 1126, 14, 128, 33, -442, -442, 01860 -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, 01861 -442, -442, -442, -442, 1050, 1050, 1050, 1050, 1050, 1050, 01862 1050, -442, -442, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 01863 1050, 1050, 1050, -442, 33, -442, 60, -442, -442, -442, 01864 -442, -442, -442, -442, 23, -442, 129, 155, 190, 157, 01865 194, 159, 196, 167, 197, 195, 198, 169, 199, 200, 01866 406, -442, 1050, 1050, 1050, -442, 857, -442, 100, 101, 01867 617, -442, -442, 63, -442, 617, 617, -442, -442, -442, 01868 -442, -442, -442, -442, -442, -442, -442, 617, 1012, 105, 01869 107, -442, 617, 118, 109, 178, 111, 123, 132, 133, 01870 134, 135, 137, 617, 617, 617, 138, 1012, 1050, 1050, 01871 209, -442, 139, -442, -442, -442, -442, -442, -442, -442, 01872 -442, -442, -442, 140, 141, 144, 145, 146, 147, 895, 01873 1088, 566, 211, 148, 149, 150, 151, -442, -442, 139, 01874 -66, -88, -84, -442, 4, -442, 154, 152, 936, -442, 01875 -442, -442, -442, -442, -442, -442, -442, -442, 184, 1088, 01876 -442, -442, -442, -442, 168, -442, 172, 617, 5, -442, 01877 6, -442, 174, 617, 153, 1050, 1050, 1050, 1050, 1050, 01878 1050, 1050, 1050, 176, 177, 179, 1050, 617, 617, 180, 01879 -442, -20, -442, 1088, 1088, 1088, 1088, 1088, 1088, -442, 01880 -442, 24, -23, -442, -24, -442, 1088, 1088, 1088, 1088, 01881 -442, -442, -442, -442, -442, 974, 226, -442, -442, 221, 01882 -3, 241, 252, 182, 617, 271, 617, 1050, -442, 185, 01883 617, -442, 186, -442, -442, 188, 192, -442, -442, 617, 01884 617, 617, -442, 191, -442, 1050, 253, 278, -442, 139, 01885 174, 250, 201, 202, 203, 204, 1088, -442, -442, -442, 01886 205, 206, 207, 208, -442, -442, -442, 244, 210, -442, 01887 617, 617, 1050, 216, -442, 216, -442, 222, 617, 223, 01888 1050, 1050, 1050, -442, -442, -442, 1050, 617, -442, -442, 01889 -442, 227, 1050, 1088, 1088, 1088, 1088, -442, 1088, 1088, 01890 1088, 1088, 295, -442, 280, 224, 228, 222, 230, 259, 01891 -442, -442, 1050, 219, 617, -442, -442, -442, 234, -442, 01892 -442, 235, 231, 236, 240, 242, 238, 243, 245, 246, 01893 -442, -442, 309, 41, 311, -442, -442, 239, -442, -442, 01894 1088, -442, 1088, 1088, -442, -442, -442, -442, 617, -442, 01895 715, 58, 330, -442, 247, 248, 257, -442, 255, -442, 01896 715, 617, -442, -442, -442, 336, 263, 301, 617, 351, 01897 355, -442, 617, 617, -442, -442 01898 }; 01899 01900 /* YYPGOTO[NTERM-NUM]. */ 01901 static const yytype_int16 yypgoto[] = 01902 { 01903 -442, -442, -442, 290, 292, 294, 296, -115, -113, -441, 01904 -442, 346, 362, -106, -442, -205, 50, -442, -246, -442, 01905 -41, -442, -32, -442, -58, 277, -442, -97, 213, -232, 01906 338, -442, -442, -442, -442, -442, 342, -442, -442, -442, 01907 -442, 7, -442, 62, -442, -442, 370, -442, -442, -442, 01908 -442, 395, -442, -442, -387, -59, 166, -107, -442, 383, 01909 -442, -442, -442, -442, -442, 54, -4, -442, -442, 36, 01910 -442, -442 01911 }; 01912 01913 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 01914 positive, shift that token. If negative, reduce the rule which 01915 number is the opposite. If zero, do what YYDEFACT says. 01916 If YYTABLE_NINF, syntax error. */ 01917 #define YYTABLE_NINF -123 01918 static const yytype_int16 yytable[] = 01919 { 01920 79, 205, 181, 206, 191, 291, 95, 194, 84, 34, 01921 23, 208, 470, 330, 366, 79, 37, 105, 322, 324, 01922 344, 346, -60, 195, 332, 4, 17, 109, 18, 211, 01923 480, 109, 215, 216, 367, 196, 217, 218, 219, 220, 01924 221, 222, 26, 23, 331, 226, 45, 340, 227, 109, 01925 105, 197, 198, 199, 200, 201, 202, 203, 204, 345, 01926 345, 41, 42, 43, 47, 34, 165, 184, 197, 198, 01927 199, 200, 201, 202, 203, 204, 46, 185, 50, 190, 01928 376, 376, 190, 478, 107, 7, 8, 9, 10, 378, 01929 379, 48, 85, 486, 27, 28, 29, 30, 31, 52, 01930 38, 376, 209, 210, 190, 212, 213, 190, 190, 389, 01931 54, 190, 190, 190, 190, 190, 190, 223, 224, 225, 01932 190, 258, 309, 410, 260, 261, 262, 230, 376, 96, 01933 97, 282, 89, 231, 377, 90, 282, 282, 197, 198, 01934 199, 200, 201, 202, 203, 204, 159, 160, 282, 228, 01935 229, 469, 91, 282, 264, 92, 233, 234, -25, -25, 01936 -24, -24, -23, -23, 282, 282, 282, 287, 479, -61, 01937 -22, -22, 235, 236, 100, 101, 79, 102, 108, 162, 01938 158, -122, 163, 182, 186, 183, 307, 192, 430, 352, 01939 431, 354, 355, 356, -29, 79, 308, 190, -28, 362, 01940 -27, -26, -32, 238, 268, -33, 5, 239, 269, 288, 01941 262, 290, 6, 294, 295, 296, 370, 371, 372, 373, 01942 374, 375, 7, 8, 9, 10, 293, 297, 282, 380, 01943 381, 382, 383, 310, 282, 325, 298, 299, 300, 301, 01944 11, 302, 306, 311, 338, 388, 313, 314, 282, 282, 01945 315, 316, 317, 318, 326, 327, 328, 329, 335, 336, 01946 366, 350, 390, 351, 190, 353, 190, 190, 190, 357, 01947 358, 333, 341, 391, 190, 394, 342, 408, 347, 417, 01948 359, 360, 409, 361, 365, 282, 412, 282, 392, 398, 01949 400, 282, 401, 435, 436, 437, 402, 406, 422, 450, 01950 282, 282, 282, 264, 451, 413, 414, 415, 416, 418, 01951 419, 420, 421, 345, 424, 190, 442, 443, 444, 445, 01952 429, 446, 447, 448, 449, 455, 432, 434, 452, 456, 01953 468, 282, 282, 407, 440, 460, 453, 454, 205, 282, 01954 206, 458, 459, 461, 462, 464, 463, 472, 282, 473, 01955 465, 481, 466, 467, 482, 483, 205, 488, 206, 485, 01956 190, 284, 285, 474, 484, 475, 476, 489, 190, 190, 01957 190, 490, 492, 286, 190, 282, 493, 149, 292, 150, 01958 441, 151, 87, 152, 49, 188, 386, 99, 94, 303, 01959 304, 305, -35, 257, 17, 51, 18, 385, 24, 40, 01960 190, 397, 438, 6, -35, -35, 411, 0, 0, 282, 01961 0, 55, 56, -35, -35, -35, -35, 0, 0, -35, 01962 19, 0, 282, 0, 0, 0, 0, 20, 17, 282, 01963 18, 21, 240, 282, 282, 0, 0, 0, 0, 0, 01964 0, 0, 0, 0, 241, 242, 0, 0, 0, 0, 01965 0, 0, 0, 343, 0, 0, 0, 0, 0, 349, 01966 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01967 0, 0, 0, 363, 364, 0, 0, 0, 120, 121, 01968 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 01969 132, 133, 0, 0, 0, 0, 0, 243, 0, 244, 01970 245, 141, 142, 0, 246, 247, 248, 0, 0, 0, 01971 393, 0, 395, 0, 249, 0, 399, 250, 0, 251, 01972 0, 0, 252, 0, 0, 403, 404, 405, 0, 55, 01973 56, 0, 103, 58, 59, 60, 61, 62, 63, 64, 01974 65, 66, 67, 68, 69, 70, 17, 0, 18, 0, 01975 0, 0, 0, 0, 0, 0, 425, 426, 0, 0, 01976 0, 0, 0, 0, 433, 0, 0, 0, 0, 71, 01977 0, 55, 56, 439, 103, 166, 167, 168, 169, 170, 01978 171, 172, 173, 174, 175, 176, 69, 70, 17, 0, 01979 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01980 457, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01981 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 01982 270, 271, 55, 56, 272, 0, 0, 0, 0, 72, 01983 0, 0, 73, 0, 477, 74, 0, 75, 104, 17, 01984 0, 18, 0, 273, 274, 275, 0, 487, 0, 0, 01985 0, 0, 0, 0, 491, 276, 277, 0, 494, 495, 01986 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01987 0, 72, 0, 0, 73, 278, 0, 74, 0, 75, 01988 323, 0, 0, 0, 0, 0, 0, 0, 0, 120, 01989 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 01990 131, 132, 133, 0, 0, 0, 0, 0, 243, 0, 01991 244, 245, 141, 142, 0, 246, 247, 248, 270, 271, 01992 0, 0, 272, 0, 0, 0, 0, 0, 279, 0, 01993 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01994 0, 273, 274, 275, 0, 0, 0, 0, 0, 0, 01995 0, 0, 0, 276, 277, 0, 0, 0, 0, 0, 01996 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 01997 0, 0, 0, 278, 0, 0, 0, 0, 0, 0, 01998 0, 0, 0, 0, 0, 0, 0, 120, 121, 122, 01999 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 02000 133, 0, 0, 0, 0, 0, 243, 0, 244, 245, 02001 141, 142, 0, 246, 247, 248, 0, 0, 0, 0, 02002 0, 0, 0, 0, 55, 56, 279, 103, 58, 59, 02003 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 02004 70, 17, 0, 18, 0, 0, 0, 0, 0, 0, 02005 0, 0, 0, 0, 0, 0, 187, 0, 0, 0, 02006 0, 0, 55, 56, 71, 103, 58, 59, 60, 61, 02007 62, 63, 64, 65, 66, 67, 68, 69, 70, 17, 02008 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 02009 0, 0, 0, 0, 263, 0, 0, 0, 0, 0, 02010 55, 56, 71, 103, 166, 167, 168, 169, 170, 171, 02011 172, 173, 174, 175, 176, 69, 70, 17, 0, 18, 02012 0, 0, 0, 0, 72, 0, 0, 73, 0, 0, 02013 74, 0, 75, 0, 0, 0, 0, 0, 0, 0, 02014 71, 55, 56, 0, 103, 58, 59, 60, 61, 62, 02015 63, 64, 65, 66, 67, 68, 69, 70, 17, 0, 02016 18, 0, 72, 0, 0, 73, 0, 0, 74, 0, 02017 75, 0, 0, 337, 0, 0, 0, 0, 0, 55, 02018 56, 71, 103, 58, 59, 60, 61, 62, 63, 64, 02019 65, 66, 67, 68, 69, 70, 17, 0, 18, 0, 02020 72, 0, 0, 73, 0, 319, 74, 0, 75, 0, 02021 0, 384, 0, 0, 0, 0, 0, 55, 56, 71, 02022 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 02023 67, 68, 69, 70, 17, 0, 18, 0, 0, 0, 02024 0, 72, 0, 0, 73, 0, 0, 74, 0, 75, 02025 0, 0, 0, 0, 0, 55, 56, 71, 103, 58, 02026 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 02027 69, 70, 17, 0, 18, 0, 0, 0, 0, 72, 02028 0, 0, 73, 0, 0, 74, 0, 75, 0, 0, 02029 0, 0, 0, 55, 56, 71, 103, 166, 167, 168, 02030 169, 170, 171, 172, 173, 174, 175, 176, 69, 70, 02031 17, 0, 18, 0, 0, 0, 0, 72, 0, 0, 02032 73, 0, 0, 74, 0, 75, 0, 0, 0, 0, 02033 0, 55, 56, 71, 193, 58, 59, 60, 61, 62, 02034 63, 64, 65, 66, 67, 68, 69, 70, 17, 0, 02035 18, 0, 0, 0, 0, 72, 0, 0, 73, 0, 02036 0, 74, 0, 75, 0, 0, 0, 0, 0, 0, 02037 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 02038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 02039 0, 0, 0, 72, 0, 0, 73, 0, 0, 74, 02040 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 02041 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 02042 0, 0, 111, 0, 0, 0, 0, 0, 0, 0, 02043 0, 72, 112, 113, 73, 0, 0, 74, 0, 75, 02044 0, 0, 114, 115, 116, 117, 118, 119, 120, 121, 02045 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 02046 132, 133, 134, 135, 136, 0, 0, 137, 138, 139, 02047 140, 141, 142, 143, 144, 145, 146, 147, 148 02048 }; 02049 02050 static const yytype_int16 yycheck[] = 02051 { 02052 32, 116, 99, 116, 111, 210, 47, 114, 29, 23, 02053 3, 117, 453, 259, 34, 47, 30, 75, 250, 251, 02054 15, 15, 106, 9, 112, 0, 22, 115, 24, 136, 02055 471, 115, 139, 140, 54, 21, 143, 144, 145, 146, 02056 147, 148, 58, 36, 110, 152, 103, 279, 154, 115, 02057 108, 10, 11, 12, 13, 14, 15, 16, 17, 54, 02058 54, 49, 50, 51, 20, 23, 98, 104, 10, 11, 02059 12, 13, 14, 15, 16, 17, 58, 114, 103, 111, 02060 104, 104, 114, 470, 77, 41, 42, 43, 44, 112, 02061 114, 47, 113, 480, 61, 62, 63, 64, 65, 24, 02062 114, 104, 134, 135, 136, 137, 138, 139, 140, 112, 02063 4, 143, 144, 145, 146, 147, 148, 149, 150, 151, 02064 152, 180, 229, 369, 182, 183, 184, 104, 104, 32, 02065 33, 190, 103, 110, 110, 103, 195, 196, 10, 11, 02066 12, 13, 14, 15, 16, 17, 52, 53, 207, 89, 02067 90, 110, 103, 212, 186, 108, 27, 28, 3, 4, 02068 3, 4, 3, 4, 223, 224, 225, 208, 110, 106, 02069 3, 4, 3, 4, 4, 4, 208, 4, 106, 4, 02070 24, 0, 24, 109, 106, 109, 227, 56, 393, 296, 02071 395, 298, 299, 300, 4, 227, 228, 229, 4, 306, 02072 4, 4, 7, 4, 104, 7, 25, 7, 107, 104, 02073 268, 104, 31, 104, 36, 104, 313, 314, 315, 316, 02074 317, 318, 41, 42, 43, 44, 108, 104, 287, 326, 02075 327, 328, 329, 24, 293, 24, 104, 104, 104, 104, 02076 59, 104, 104, 104, 60, 24, 106, 106, 307, 308, 02077 106, 106, 106, 106, 106, 106, 106, 106, 104, 107, 02078 34, 108, 21, 295, 296, 297, 298, 299, 300, 301, 02079 302, 264, 104, 21, 306, 4, 104, 24, 104, 376, 02080 104, 104, 4, 104, 104, 344, 36, 346, 106, 104, 02081 104, 350, 104, 400, 401, 402, 104, 106, 54, 4, 02082 359, 360, 361, 335, 24, 104, 104, 104, 104, 104, 02083 104, 104, 104, 54, 104, 347, 413, 414, 415, 416, 02084 104, 418, 419, 420, 421, 432, 104, 104, 104, 110, 02085 21, 390, 391, 365, 107, 104, 108, 107, 453, 398, 02086 453, 107, 107, 107, 104, 107, 104, 36, 407, 110, 02087 107, 21, 107, 107, 107, 107, 471, 21, 471, 104, 02088 392, 195, 196, 460, 107, 462, 463, 104, 400, 401, 02089 402, 70, 21, 207, 406, 434, 21, 87, 212, 87, 02090 412, 87, 36, 87, 22, 108, 336, 49, 46, 223, 02091 224, 225, 20, 180, 22, 25, 24, 335, 3, 16, 02092 432, 347, 406, 31, 32, 33, 370, -1, -1, 468, 02093 -1, 5, 6, 41, 42, 43, 44, -1, -1, 47, 02094 48, -1, 481, -1, -1, -1, -1, 55, 22, 488, 02095 24, 59, 26, 492, 493, -1, -1, -1, -1, -1, 02096 -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 02097 -1, -1, -1, 287, -1, -1, -1, -1, -1, 293, 02098 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02099 -1, -1, -1, 307, 308, -1, -1, -1, 72, 73, 02100 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 02101 84, 85, -1, -1, -1, -1, -1, 91, -1, 93, 02102 94, 95, 96, -1, 98, 99, 100, -1, -1, -1, 02103 344, -1, 346, -1, 108, -1, 350, 111, -1, 113, 02104 -1, -1, 116, -1, -1, 359, 360, 361, -1, 5, 02105 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, 02106 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, 02107 -1, -1, -1, -1, -1, -1, 390, 391, -1, -1, 02108 -1, -1, -1, -1, 398, -1, -1, -1, -1, 45, 02109 -1, 5, 6, 407, 8, 9, 10, 11, 12, 13, 02110 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 02111 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02112 434, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02113 -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, 02114 3, 4, 5, 6, 7, -1, -1, -1, -1, 105, 02115 -1, -1, 108, -1, 468, 111, -1, 113, 114, 22, 02116 -1, 24, -1, 26, 27, 28, -1, 481, -1, -1, 02117 -1, -1, -1, -1, 488, 38, 39, -1, 492, 493, 02118 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02119 -1, 105, -1, -1, 108, 58, -1, 111, -1, 113, 02120 114, -1, -1, -1, -1, -1, -1, -1, -1, 72, 02121 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 02122 83, 84, 85, -1, -1, -1, -1, -1, 91, -1, 02123 93, 94, 95, 96, -1, 98, 99, 100, 3, 4, 02124 -1, -1, 7, -1, -1, -1, -1, -1, 111, -1, 02125 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02126 -1, 26, 27, 28, -1, -1, -1, -1, -1, -1, 02127 -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, 02128 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02129 -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, 02130 -1, -1, -1, -1, -1, -1, -1, 72, 73, 74, 02131 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 02132 85, -1, -1, -1, -1, -1, 91, -1, 93, 94, 02133 95, 96, -1, 98, 99, 100, -1, -1, -1, -1, 02134 -1, -1, -1, -1, 5, 6, 111, 8, 9, 10, 02135 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 02136 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, 02137 -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, 02138 -1, -1, 5, 6, 45, 8, 9, 10, 11, 12, 02139 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 02140 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, 02141 -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, 02142 5, 6, 45, 8, 9, 10, 11, 12, 13, 14, 02143 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, 02144 -1, -1, -1, -1, 105, -1, -1, 108, -1, -1, 02145 111, -1, 113, -1, -1, -1, -1, -1, -1, -1, 02146 45, 5, 6, -1, 8, 9, 10, 11, 12, 13, 02147 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 02148 24, -1, 105, -1, -1, 108, -1, -1, 111, -1, 02149 113, -1, -1, 37, -1, -1, -1, -1, -1, 5, 02150 6, 45, 8, 9, 10, 11, 12, 13, 14, 15, 02151 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, 02152 105, -1, -1, 108, -1, 110, 111, -1, 113, -1, 02153 -1, 37, -1, -1, -1, -1, -1, 5, 6, 45, 02154 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 02155 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, 02156 -1, 105, -1, -1, 108, -1, -1, 111, -1, 113, 02157 -1, -1, -1, -1, -1, 5, 6, 45, 8, 9, 02158 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 02159 20, 21, 22, -1, 24, -1, -1, -1, -1, 105, 02160 -1, -1, 108, -1, -1, 111, -1, 113, -1, -1, 02161 -1, -1, -1, 5, 6, 45, 8, 9, 10, 11, 02162 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 02163 22, -1, 24, -1, -1, -1, -1, 105, -1, -1, 02164 108, -1, -1, 111, -1, 113, -1, -1, -1, -1, 02165 -1, 5, 6, 45, 8, 9, 10, 11, 12, 13, 02166 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 02167 24, -1, -1, -1, -1, 105, -1, -1, 108, -1, 02168 -1, 111, -1, 113, -1, -1, -1, -1, -1, -1, 02169 -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, 02170 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 02171 -1, -1, -1, 105, -1, -1, 108, -1, -1, 111, 02172 -1, 113, -1, -1, -1, -1, -1, -1, -1, -1, 02173 -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, 02174 -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, 02175 -1, 105, 56, 57, 108, -1, -1, 111, -1, 113, 02176 -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 02177 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 02178 84, 85, 86, 87, 88, -1, -1, 91, 92, 93, 02179 94, 95, 96, 97, 98, 99, 100, 101, 102 02180 }; 02181 02182 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 02183 symbol of state STATE-NUM. */ 02184 static const yytype_uint8 yystos[] = 02185 { 02186 0, 148, 149, 150, 0, 25, 31, 41, 42, 43, 02187 44, 59, 129, 165, 167, 168, 175, 22, 24, 48, 02188 55, 59, 128, 158, 168, 169, 58, 61, 62, 63, 02189 64, 65, 130, 163, 23, 176, 177, 30, 114, 166, 02190 176, 49, 50, 51, 155, 103, 58, 20, 47, 129, 02191 103, 163, 24, 153, 4, 5, 6, 8, 9, 10, 02192 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 02193 21, 45, 105, 108, 111, 113, 118, 137, 138, 139, 02194 140, 141, 158, 172, 29, 113, 164, 128, 180, 103, 02195 103, 103, 108, 156, 153, 137, 32, 33, 147, 147, 02196 4, 4, 4, 8, 114, 141, 142, 158, 106, 115, 02197 35, 46, 56, 57, 66, 67, 68, 69, 70, 71, 02198 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 02199 82, 83, 84, 85, 86, 87, 88, 91, 92, 93, 02200 94, 95, 96, 97, 98, 99, 100, 101, 102, 120, 02201 121, 122, 123, 178, 184, 185, 187, 188, 24, 52, 02202 53, 154, 4, 24, 157, 139, 9, 10, 11, 12, 02203 13, 14, 15, 16, 17, 18, 19, 124, 125, 127, 02204 139, 144, 109, 109, 104, 114, 106, 37, 142, 143, 02205 139, 174, 56, 8, 174, 9, 21, 10, 11, 12, 02206 13, 14, 15, 16, 17, 124, 125, 126, 130, 139, 02207 139, 174, 139, 139, 181, 174, 174, 174, 174, 174, 02208 174, 174, 174, 139, 139, 139, 174, 130, 89, 90, 02209 104, 110, 152, 27, 28, 3, 4, 119, 4, 7, 02210 26, 38, 39, 91, 93, 94, 98, 99, 100, 108, 02211 111, 113, 116, 120, 121, 122, 123, 145, 172, 151, 02212 141, 141, 141, 37, 139, 160, 161, 162, 104, 107, 02213 3, 4, 7, 26, 27, 28, 38, 39, 58, 111, 02214 145, 171, 172, 173, 173, 173, 173, 137, 104, 132, 02215 104, 132, 173, 108, 104, 36, 104, 104, 104, 104, 02216 104, 104, 104, 173, 173, 173, 104, 137, 139, 174, 02217 24, 104, 135, 106, 106, 106, 106, 106, 106, 110, 02218 144, 146, 146, 114, 146, 24, 106, 106, 106, 106, 02219 135, 110, 112, 158, 159, 104, 107, 37, 60, 170, 02220 146, 104, 104, 173, 15, 54, 15, 104, 186, 173, 02221 108, 139, 174, 139, 174, 174, 174, 139, 139, 104, 02222 104, 104, 174, 173, 173, 104, 34, 54, 133, 136, 02223 144, 144, 144, 144, 144, 144, 104, 110, 112, 114, 02224 144, 144, 144, 144, 37, 160, 133, 134, 24, 112, 02225 21, 21, 106, 173, 4, 173, 174, 182, 104, 173, 02226 104, 104, 104, 173, 173, 173, 106, 139, 24, 4, 02227 135, 186, 36, 104, 104, 104, 104, 144, 104, 104, 02228 104, 104, 54, 131, 104, 173, 173, 182, 183, 104, 02229 132, 132, 104, 173, 104, 174, 174, 174, 183, 173, 02230 107, 139, 144, 144, 144, 144, 144, 144, 144, 144, 02231 4, 24, 104, 108, 107, 174, 110, 173, 107, 107, 02232 104, 107, 104, 104, 107, 107, 107, 107, 21, 110, 02233 126, 179, 36, 110, 144, 144, 144, 173, 171, 110, 02234 126, 21, 107, 107, 107, 104, 171, 173, 21, 104, 02235 70, 173, 21, 21, 173, 173 02236 }; 02237 02238 #define yyerrok (yyerrstatus = 0) 02239 #define yyclearin (yychar = YYEMPTY) 02240 #define YYEMPTY (-2) 02241 #define YYEOF 0 02242 02243 #define YYACCEPT goto yyacceptlab 02244 #define YYABORT goto yyabortlab 02245 #define YYERROR goto yyerrorlab 02246 02247 02248 /* Like YYERROR except do call yyerror. This remains here temporarily 02249 to ease the transition to the new meaning of YYERROR, for GCC. 02250 Once GCC version 2 has supplanted version 1, this can go. */ 02251 02252 #define YYFAIL goto yyerrlab 02253 02254 #define YYRECOVERING() (!!yyerrstatus) 02255 02256 #define YYBACKUP(Token, Value) \ 02257 do \ 02258 if (yychar == YYEMPTY && yylen == 1) \ 02259 { \ 02260 yychar = (Token); \ 02261 yylval = (Value); \ 02262 yytoken = YYTRANSLATE (yychar); \ 02263 YYPOPSTACK (1); \ 02264 goto yybackup; \ 02265 } \ 02266 else \ 02267 { \ 02268 yyerror (YY_("syntax error: cannot back up")); \ 02269 YYERROR; \ 02270 } \ 02271 while (YYID (0)) 02272 02273 02274 #define YYTERROR 1 02275 #define YYERRCODE 256 02276 02277 02278 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 02279 If N is 0, then set CURRENT to the empty location which ends 02280 the previous symbol: RHS[0] (always defined). */ 02281 02282 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 02283 #ifndef YYLLOC_DEFAULT 02284 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 02285 do \ 02286 if (YYID (N)) \ 02287 { \ 02288 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 02289 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 02290 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 02291 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 02292 } \ 02293 else \ 02294 { \ 02295 (Current).first_line = (Current).last_line = \ 02296 YYRHSLOC (Rhs, 0).last_line; \ 02297 (Current).first_column = (Current).last_column = \ 02298 YYRHSLOC (Rhs, 0).last_column; \ 02299 } \ 02300 while (YYID (0)) 02301 #endif 02302 02303 02304 /* YY_LOCATION_PRINT -- Print the location on the stream. 02305 This macro was not mandated originally: define only if we know 02306 we won't break user code: when these are the locations we know. */ 02307 02308 #ifndef YY_LOCATION_PRINT 02309 # if YYLTYPE_IS_TRIVIAL 02310 # define YY_LOCATION_PRINT(File, Loc) \ 02311 fprintf (File, "%d.%d-%d.%d", \ 02312 (Loc).first_line, (Loc).first_column, \ 02313 (Loc).last_line, (Loc).last_column) 02314 # else 02315 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 02316 # endif 02317 #endif 02318 02319 02320 /* YYLEX -- calling `yylex' with the right arguments. */ 02321 02322 #ifdef YYLEX_PARAM 02323 # define YYLEX yylex (YYLEX_PARAM) 02324 #else 02325 # define YYLEX yylex () 02326 #endif 02327 02328 /* Enable debugging if requested. */ 02329 #if YYDEBUG 02330 02331 # ifndef YYFPRINTF 02332 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 02333 # define YYFPRINTF fprintf 02334 # endif 02335 02336 # define YYDPRINTF(Args) \ 02337 do { \ 02338 if (yydebug) \ 02339 YYFPRINTF Args; \ 02340 } while (YYID (0)) 02341 02342 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 02343 do { \ 02344 if (yydebug) \ 02345 { \ 02346 YYFPRINTF (stderr, "%s ", Title); \ 02347 yy_symbol_print (stderr, \ 02348 Type, Value); \ 02349 YYFPRINTF (stderr, "\n"); \ 02350 } \ 02351 } while (YYID (0)) 02352 02353 02354 /*--------------------------------. 02355 | Print this symbol on YYOUTPUT. | 02356 `--------------------------------*/ 02357 02358 /*ARGSUSED*/ 02359 #if (defined __STDC__ || defined __C99__FUNC__ \ 02360 || defined __cplusplus || defined _MSC_VER) 02361 static void 02362 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 02363 #else 02364 static void 02365 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 02366 FILE *yyoutput; 02367 int yytype; 02368 YYSTYPE const * const yyvaluep; 02369 #endif 02370 { 02371 if (!yyvaluep) 02372 return; 02373 # ifdef YYPRINT 02374 if (yytype < YYNTOKENS) 02375 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 02376 # else 02377 YYUSE (yyoutput); 02378 # endif 02379 switch (yytype) 02380 { 02381 default: 02382 break; 02383 } 02384 } 02385 02386 02387 /*--------------------------------. 02388 | Print this symbol on YYOUTPUT. | 02389 `--------------------------------*/ 02390 02391 #if (defined __STDC__ || defined __C99__FUNC__ \ 02392 || defined __cplusplus || defined _MSC_VER) 02393 static void 02394 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 02395 #else 02396 static void 02397 yy_symbol_print (yyoutput, yytype, yyvaluep) 02398 FILE *yyoutput; 02399 int yytype; 02400 YYSTYPE const * const yyvaluep; 02401 #endif 02402 { 02403 if (yytype < YYNTOKENS) 02404 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 02405 else 02406 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 02407 02408 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 02409 YYFPRINTF (yyoutput, ")"); 02410 } 02411 02412 /*------------------------------------------------------------------. 02413 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 02414 | TOP (included). | 02415 `------------------------------------------------------------------*/ 02416 02417 #if (defined __STDC__ || defined __C99__FUNC__ \ 02418 || defined __cplusplus || defined _MSC_VER) 02419 static void 02420 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) 02421 #else 02422 static void 02423 yy_stack_print (bottom, top) 02424 yytype_int16 *bottom; 02425 yytype_int16 *top; 02426 #endif 02427 { 02428 YYFPRINTF (stderr, "Stack now"); 02429 for (; bottom <= top; ++bottom) 02430 YYFPRINTF (stderr, " %d", *bottom); 02431 YYFPRINTF (stderr, "\n"); 02432 } 02433 02434 # define YY_STACK_PRINT(Bottom, Top) \ 02435 do { \ 02436 if (yydebug) \ 02437 yy_stack_print ((Bottom), (Top)); \ 02438 } while (YYID (0)) 02439 02440 02441 /*------------------------------------------------. 02442 | Report that the YYRULE is going to be reduced. | 02443 `------------------------------------------------*/ 02444 02445 #if (defined __STDC__ || defined __C99__FUNC__ \ 02446 || defined __cplusplus || defined _MSC_VER) 02447 static void 02448 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 02449 #else 02450 static void 02451 yy_reduce_print (yyvsp, yyrule) 02452 YYSTYPE *yyvsp; 02453 int yyrule; 02454 #endif 02455 { 02456 int yynrhs = yyr2[yyrule]; 02457 int yyi; 02458 unsigned long int yylno = yyrline[yyrule]; 02459 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 02460 yyrule - 1, yylno); 02461 /* The symbols being reduced. */ 02462 for (yyi = 0; yyi < yynrhs; yyi++) 02463 { 02464 fprintf (stderr, " $%d = ", yyi + 1); 02465 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 02466 &(yyvsp[(yyi + 1) - (yynrhs)]) 02467 ); 02468 fprintf (stderr, "\n"); 02469 } 02470 } 02471 02472 # define YY_REDUCE_PRINT(Rule) \ 02473 do { \ 02474 if (yydebug) \ 02475 yy_reduce_print (yyvsp, Rule); \ 02476 } while (YYID (0)) 02477 02478 /* Nonzero means print parse trace. It is left uninitialized so that 02479 multiple parsers can coexist. */ 02480 int yydebug; 02481 #else /* !YYDEBUG */ 02482 # define YYDPRINTF(Args) 02483 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 02484 # define YY_STACK_PRINT(Bottom, Top) 02485 # define YY_REDUCE_PRINT(Rule) 02486 #endif /* !YYDEBUG */ 02487 02488 02489 /* YYINITDEPTH -- initial size of the parser's stacks. */ 02490 #ifndef YYINITDEPTH 02491 # define YYINITDEPTH 200 02492 #endif 02493 02494 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 02495 if the built-in stack extension method is used). 02496 02497 Do not make this value too large; the results are undefined if 02498 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 02499 evaluated with infinite-precision integer arithmetic. */ 02500 02501 #ifndef YYMAXDEPTH 02502 # define YYMAXDEPTH 10000 02503 #endif 02504 02505 02506 02507 #if YYERROR_VERBOSE 02508 02509 # ifndef yystrlen 02510 # if defined __GLIBC__ && defined _STRING_H 02511 # define yystrlen strlen 02512 # else 02513 /* Return the length of YYSTR. */ 02514 #if (defined __STDC__ || defined __C99__FUNC__ \ 02515 || defined __cplusplus || defined _MSC_VER) 02516 static YYSIZE_T 02517 yystrlen (const char *yystr) 02518 #else 02519 static YYSIZE_T 02520 yystrlen (yystr) 02521 const char *yystr; 02522 #endif 02523 { 02524 YYSIZE_T yylen; 02525 for (yylen = 0; yystr[yylen]; yylen++) 02526 continue; 02527 return yylen; 02528 } 02529 # endif 02530 # endif 02531 02532 # ifndef yystpcpy 02533 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 02534 # define yystpcpy stpcpy 02535 # else 02536 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 02537 YYDEST. */ 02538 #if (defined __STDC__ || defined __C99__FUNC__ \ 02539 || defined __cplusplus || defined _MSC_VER) 02540 static char * 02541 yystpcpy (char *yydest, const char *yysrc) 02542 #else 02543 static char * 02544 yystpcpy (yydest, yysrc) 02545 char *yydest; 02546 const char *yysrc; 02547 #endif 02548 { 02549 char *yyd = yydest; 02550 const char *yys = yysrc; 02551 02552 while ((*yyd++ = *yys++) != '\0') 02553 continue; 02554 02555 return yyd - 1; 02556 } 02557 # endif 02558 # endif 02559 02560 # ifndef yytnamerr 02561 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 02562 quotes and backslashes, so that it's suitable for yyerror. The 02563 heuristic is that double-quoting is unnecessary unless the string 02564 contains an apostrophe, a comma, or backslash (other than 02565 backslash-backslash). YYSTR is taken from yytname. If YYRES is 02566 null, do not copy; instead, return the length of what the result 02567 would have been. */ 02568 static YYSIZE_T 02569 yytnamerr (char *yyres, const char *yystr) 02570 { 02571 if (*yystr == '"') 02572 { 02573 YYSIZE_T yyn = 0; 02574 char const *yyp = yystr; 02575 02576 for (;;) 02577 switch (*++yyp) 02578 { 02579 case '\'': 02580 case ',': 02581 goto do_not_strip_quotes; 02582 02583 case '\\': 02584 if (*++yyp != '\\') 02585 goto do_not_strip_quotes; 02586 /* Fall through. */ 02587 default: 02588 if (yyres) 02589 yyres[yyn] = *yyp; 02590 yyn++; 02591 break; 02592 02593 case '"': 02594 if (yyres) 02595 yyres[yyn] = '\0'; 02596 return yyn; 02597 } 02598 do_not_strip_quotes: ; 02599 } 02600 02601 if (! yyres) 02602 return yystrlen (yystr); 02603 02604 return yystpcpy (yyres, yystr) - yyres; 02605 } 02606 # endif 02607 02608 /* Copy into YYRESULT an error message about the unexpected token 02609 YYCHAR while in state YYSTATE. Return the number of bytes copied, 02610 including the terminating null byte. If YYRESULT is null, do not 02611 copy anything; just return the number of bytes that would be 02612 copied. As a special case, return 0 if an ordinary "syntax error" 02613 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 02614 size calculation. */ 02615 static YYSIZE_T 02616 yysyntax_error (char *yyresult, int yystate, int yychar) 02617 { 02618 int yyn = yypact[yystate]; 02619 02620 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 02621 return 0; 02622 else 02623 { 02624 int yytype = YYTRANSLATE (yychar); 02625 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 02626 YYSIZE_T yysize = yysize0; 02627 YYSIZE_T yysize1; 02628 int yysize_overflow = 0; 02629 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 02630 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 02631 int yyx; 02632 02633 # if 0 02634 /* This is so xgettext sees the translatable formats that are 02635 constructed on the fly. */ 02636 YY_("syntax error, unexpected %s"); 02637 YY_("syntax error, unexpected %s, expecting %s"); 02638 YY_("syntax error, unexpected %s, expecting %s or %s"); 02639 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 02640 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 02641 # endif 02642 char *yyfmt; 02643 char const *yyf; 02644 static char const yyunexpected[] = "syntax error, unexpected %s"; 02645 static char const yyexpecting[] = ", expecting %s"; 02646 static char const yyor[] = " or %s"; 02647 char yyformat[sizeof yyunexpected 02648 + sizeof yyexpecting - 1 02649 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 02650 * (sizeof yyor - 1))]; 02651 char const *yyprefix = yyexpecting; 02652 02653 /* Start YYX at -YYN if negative to avoid negative indexes in 02654 YYCHECK. */ 02655 int yyxbegin = yyn < 0 ? -yyn : 0; 02656 02657 /* Stay within bounds of both yycheck and yytname. */ 02658 int yychecklim = YYLAST - yyn + 1; 02659 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 02660 int yycount = 1; 02661 02662 yyarg[0] = yytname[yytype]; 02663 yyfmt = yystpcpy (yyformat, yyunexpected); 02664 02665 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 02666 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 02667 { 02668 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 02669 { 02670 yycount = 1; 02671 yysize = yysize0; 02672 yyformat[sizeof yyunexpected - 1] = '\0'; 02673 break; 02674 } 02675 yyarg[yycount++] = yytname[yyx]; 02676 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 02677 yysize_overflow |= (yysize1 < yysize); 02678 yysize = yysize1; 02679 yyfmt = yystpcpy (yyfmt, yyprefix); 02680 yyprefix = yyor; 02681 } 02682 02683 yyf = YY_(yyformat); 02684 yysize1 = yysize + yystrlen (yyf); 02685 yysize_overflow |= (yysize1 < yysize); 02686 yysize = yysize1; 02687 02688 if (yysize_overflow) 02689 return YYSIZE_MAXIMUM; 02690 02691 if (yyresult) 02692 { 02693 /* Avoid sprintf, as that infringes on the user's name space. 02694 Don't have undefined behavior even if the translation 02695 produced a string with the wrong number of "%s"s. */ 02696 char *yyp = yyresult; 02697 int yyi = 0; 02698 while ((*yyp = *yyf) != '\0') 02699 { 02700 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 02701 { 02702 yyp += yytnamerr (yyp, yyarg[yyi++]); 02703 yyf += 2; 02704 } 02705 else 02706 { 02707 yyp++; 02708 yyf++; 02709 } 02710 } 02711 } 02712 return yysize; 02713 } 02714 } 02715 #endif /* YYERROR_VERBOSE */ 02716 02717 02718 /*-----------------------------------------------. 02719 | Release the memory associated to this symbol. | 02720 `-----------------------------------------------*/ 02721 02722 /*ARGSUSED*/ 02723 #if (defined __STDC__ || defined __C99__FUNC__ \ 02724 || defined __cplusplus || defined _MSC_VER) 02725 static void 02726 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 02727 #else 02728 static void 02729 yydestruct (yymsg, yytype, yyvaluep) 02730 const char *yymsg; 02731 int yytype; 02732 YYSTYPE *yyvaluep; 02733 #endif 02734 { 02735 YYUSE (yyvaluep); 02736 02737 if (!yymsg) 02738 yymsg = "Deleting"; 02739 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 02740 02741 switch (yytype) 02742 { 02743 02744 default: 02745 break; 02746 } 02747 } 02748 02749 02750 /* Prevent warnings from -Wmissing-prototypes. */ 02751 02752 #ifdef YYPARSE_PARAM 02753 #if defined __STDC__ || defined __cplusplus 02754 int yyparse (void *YYPARSE_PARAM); 02755 #else 02756 int yyparse (); 02757 #endif 02758 #else /* ! YYPARSE_PARAM */ 02759 #if defined __STDC__ || defined __cplusplus 02760 int yyparse (void); 02761 #else 02762 int yyparse (); 02763 #endif 02764 #endif /* ! YYPARSE_PARAM */ 02765 02766 02767 02768 /* The look-ahead symbol. */ 02769 int yychar; 02770 02771 /* The semantic value of the look-ahead symbol. */ 02772 YYSTYPE yylval; 02773 02774 /* Number of syntax errors so far. */ 02775 int yynerrs; 02776 02777 02778 02779 /*----------. 02780 | yyparse. | 02781 `----------*/ 02782 02783 #ifdef YYPARSE_PARAM 02784 #if (defined __STDC__ || defined __C99__FUNC__ \ 02785 || defined __cplusplus || defined _MSC_VER) 02786 int 02787 yyparse (void *YYPARSE_PARAM) 02788 #else 02789 int 02790 yyparse (YYPARSE_PARAM) 02791 void *YYPARSE_PARAM; 02792 #endif 02793 #else /* ! YYPARSE_PARAM */ 02794 #if (defined __STDC__ || defined __C99__FUNC__ \ 02795 || defined __cplusplus || defined _MSC_VER) 02796 int 02797 yyparse (void) 02798 #else 02799 int 02800 yyparse () 02801 02802 #endif 02803 #endif 02804 { 02805 02806 int yystate; 02807 int yyn; 02808 int yyresult; 02809 /* Number of tokens to shift before error messages enabled. */ 02810 int yyerrstatus; 02811 /* Look-ahead token as an internal (translated) token number. */ 02812 int yytoken = 0; 02813 #if YYERROR_VERBOSE 02814 /* Buffer for error messages, and its allocated size. */ 02815 char yymsgbuf[128]; 02816 char *yymsg = yymsgbuf; 02817 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 02818 #endif 02819 02820 /* Three stacks and their tools: 02821 `yyss': related to states, 02822 `yyvs': related to semantic values, 02823 `yyls': related to locations. 02824 02825 Refer to the stacks thru separate pointers, to allow yyoverflow 02826 to reallocate them elsewhere. */ 02827 02828 /* The state stack. */ 02829 yytype_int16 yyssa[YYINITDEPTH]; 02830 yytype_int16 *yyss = yyssa; 02831 yytype_int16 *yyssp; 02832 02833 /* The semantic value stack. */ 02834 YYSTYPE yyvsa[YYINITDEPTH]; 02835 YYSTYPE *yyvs = yyvsa; 02836 YYSTYPE *yyvsp; 02837 02838 02839 02840 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 02841 02842 YYSIZE_T yystacksize = YYINITDEPTH; 02843 02844 /* The variables used to return semantic value and location from the 02845 action routines. */ 02846 YYSTYPE yyval; 02847 02848 02849 /* The number of symbols on the RHS of the reduced rule. 02850 Keep to zero when no symbol should be popped. */ 02851 int yylen = 0; 02852 02853 YYDPRINTF ((stderr, "Starting parse\n")); 02854 02855 yystate = 0; 02856 yyerrstatus = 0; 02857 yynerrs = 0; 02858 yychar = YYEMPTY; /* Cause a token to be read. */ 02859 02860 /* Initialize stack pointers. 02861 Waste one element of value and location stack 02862 so that they stay on the same level as the state stack. 02863 The wasted elements are never initialized. */ 02864 02865 yyssp = yyss; 02866 yyvsp = yyvs; 02867 02868 goto yysetstate; 02869 02870 /*------------------------------------------------------------. 02871 | yynewstate -- Push a new state, which is found in yystate. | 02872 `------------------------------------------------------------*/ 02873 yynewstate: 02874 /* In all cases, when you get here, the value and location stacks 02875 have just been pushed. So pushing a state here evens the stacks. */ 02876 yyssp++; 02877 02878 yysetstate: 02879 *yyssp = yystate; 02880 02881 if (yyss + yystacksize - 1 <= yyssp) 02882 { 02883 /* Get the current used size of the three stacks, in elements. */ 02884 YYSIZE_T yysize = yyssp - yyss + 1; 02885 02886 #ifdef yyoverflow 02887 { 02888 /* Give user a chance to reallocate the stack. Use copies of 02889 these so that the &'s don't force the real ones into 02890 memory. */ 02891 YYSTYPE *yyvs1 = yyvs; 02892 yytype_int16 *yyss1 = yyss; 02893 02894 02895 /* Each stack pointer address is followed by the size of the 02896 data in use in that stack, in bytes. This used to be a 02897 conditional around just the two extra args, but that might 02898 be undefined if yyoverflow is a macro. */ 02899 yyoverflow (YY_("memory exhausted"), 02900 &yyss1, yysize * sizeof (*yyssp), 02901 &yyvs1, yysize * sizeof (*yyvsp), 02902 02903 &yystacksize); 02904 02905 yyss = yyss1; 02906 yyvs = yyvs1; 02907 } 02908 #else /* no yyoverflow */ 02909 # ifndef YYSTACK_RELOCATE 02910 goto yyexhaustedlab; 02911 # else 02912 /* Extend the stack our own way. */ 02913 if (YYMAXDEPTH <= yystacksize) 02914 goto yyexhaustedlab; 02915 yystacksize *= 2; 02916 if (YYMAXDEPTH < yystacksize) 02917 yystacksize = YYMAXDEPTH; 02918 02919 { 02920 yytype_int16 *yyss1 = yyss; 02921 union yyalloc *yyptr = 02922 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 02923 if (! yyptr) 02924 goto yyexhaustedlab; 02925 YYSTACK_RELOCATE (yyss); 02926 YYSTACK_RELOCATE (yyvs); 02927 02928 # undef YYSTACK_RELOCATE 02929 if (yyss1 != yyssa) 02930 YYSTACK_FREE (yyss1); 02931 } 02932 # endif 02933 #endif /* no yyoverflow */ 02934 02935 yyssp = yyss + yysize - 1; 02936 yyvsp = yyvs + yysize - 1; 02937 02938 02939 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 02940 (unsigned long int) yystacksize)); 02941 02942 if (yyss + yystacksize - 1 <= yyssp) 02943 YYABORT; 02944 } 02945 02946 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 02947 02948 goto yybackup; 02949 02950 /*-----------. 02951 | yybackup. | 02952 `-----------*/ 02953 yybackup: 02954 02955 /* Do appropriate processing given the current state. Read a 02956 look-ahead token if we need one and don't already have one. */ 02957 02958 /* First try to decide what to do without reference to look-ahead token. */ 02959 yyn = yypact[yystate]; 02960 if (yyn == YYPACT_NINF) 02961 goto yydefault; 02962 02963 /* Not known => get a look-ahead token if don't already have one. */ 02964 02965 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 02966 if (yychar == YYEMPTY) 02967 { 02968 YYDPRINTF ((stderr, "Reading a token: ")); 02969 yychar = YYLEX; 02970 } 02971 02972 if (yychar <= YYEOF) 02973 { 02974 yychar = yytoken = YYEOF; 02975 YYDPRINTF ((stderr, "Now at end of input.\n")); 02976 } 02977 else 02978 { 02979 yytoken = YYTRANSLATE (yychar); 02980 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 02981 } 02982 02983 /* If the proper action on seeing token YYTOKEN is to reduce or to 02984 detect an error, take that action. */ 02985 yyn += yytoken; 02986 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 02987 goto yydefault; 02988 yyn = yytable[yyn]; 02989 if (yyn <= 0) 02990 { 02991 if (yyn == 0 || yyn == YYTABLE_NINF) 02992 goto yyerrlab; 02993 yyn = -yyn; 02994 goto yyreduce; 02995 } 02996 02997 if (yyn == YYFINAL) 02998 YYACCEPT; 02999 03000 /* Count tokens shifted since error; after three, turn off error 03001 status. */ 03002 if (yyerrstatus) 03003 yyerrstatus--; 03004 03005 /* Shift the look-ahead token. */ 03006 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 03007 03008 /* Discard the shifted token unless it is eof. */ 03009 if (yychar != YYEOF) 03010 yychar = YYEMPTY; 03011 03012 yystate = yyn; 03013 *++yyvsp = yylval; 03014 03015 goto yynewstate; 03016 03017 03018 /*-----------------------------------------------------------. 03019 | yydefault -- do the default action for the current state. | 03020 `-----------------------------------------------------------*/ 03021 yydefault: 03022 yyn = yydefact[yystate]; 03023 if (yyn == 0) 03024 goto yyerrlab; 03025 goto yyreduce; 03026 03027 03028 /*-----------------------------. 03029 | yyreduce -- Do a reduction. | 03030 `-----------------------------*/ 03031 yyreduce: 03032 /* yyn is the number of a rule to reduce with. */ 03033 yylen = yyr2[yyn]; 03034 03035 /* If YYLEN is nonzero, implement the default value of the action: 03036 `$$ = $1'. 03037 03038 Otherwise, the following line sets YYVAL to garbage. 03039 This behavior is undocumented and Bison 03040 users should not rely upon it. Assigning to YYVAL 03041 unconditionally makes the parser a bit smaller, and it avoids a 03042 GCC warning that YYVAL may be used uninitialized. */ 03043 yyval = yyvsp[1-yylen]; 03044 03045 03046 YY_REDUCE_PRINT (yyn); 03047 switch (yyn) 03048 { 03049 case 3: 03050 #line 1011 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03051 { 03052 if ((yyvsp[(1) - (1)].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! 03053 ThrowException("Value too large for type!"); 03054 (yyval.SIntVal) = (int32_t)(yyvsp[(1) - (1)].UIntVal); 03055 ;} 03056 break; 03057 03058 case 5: 03059 #line 1019 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03060 { 03061 if ((yyvsp[(1) - (1)].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! 03062 ThrowException("Value too large for type!"); 03063 (yyval.SInt64Val) = (int64_t)(yyvsp[(1) - (1)].UInt64Val); 03064 ;} 03065 break; 03066 03067 case 34: 03068 #line 1042 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03069 { 03070 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); 03071 ;} 03072 break; 03073 03074 case 35: 03075 #line 1045 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03076 { 03077 (yyval.StrVal) = 0; 03078 ;} 03079 break; 03080 03081 case 36: 03082 #line 1049 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03083 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} 03084 break; 03085 03086 case 37: 03087 #line 1050 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03088 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} 03089 break; 03090 03091 case 38: 03092 #line 1051 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03093 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} 03094 break; 03095 03096 case 39: 03097 #line 1052 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03098 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} 03099 break; 03100 03101 case 40: 03102 #line 1053 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03103 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} 03104 break; 03105 03106 case 41: 03107 #line 1055 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03108 { (yyval.UIntVal) = CallingConv::C; ;} 03109 break; 03110 03111 case 42: 03112 #line 1056 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03113 { (yyval.UIntVal) = CallingConv::C; ;} 03114 break; 03115 03116 case 43: 03117 #line 1057 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03118 { (yyval.UIntVal) = CallingConv::CSRet; ;} 03119 break; 03120 03121 case 44: 03122 #line 1058 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03123 { (yyval.UIntVal) = CallingConv::Fast; ;} 03124 break; 03125 03126 case 45: 03127 #line 1059 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03128 { (yyval.UIntVal) = CallingConv::Cold; ;} 03129 break; 03130 03131 case 46: 03132 #line 1060 "/build/buildd/llvm-1.8b/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 47: 03141 #line 1068 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03142 { (yyval.UIntVal) = 0; ;} 03143 break; 03144 03145 case 48: 03146 #line 1069 "/build/buildd/llvm-1.8b/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 49: 03155 #line 1074 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03156 { (yyval.UIntVal) = 0; ;} 03157 break; 03158 03159 case 50: 03160 #line 1075 "/build/buildd/llvm-1.8b/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 51: 03169 #line 1082 "/build/buildd/llvm-1.8b/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 52: 03179 #line 1089 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03180 { (yyval.StrVal) = 0; ;} 03181 break; 03182 03183 case 53: 03184 #line 1090 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03185 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} 03186 break; 03187 03188 case 54: 03189 #line 1095 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03190 {;} 03191 break; 03192 03193 case 55: 03194 #line 1096 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03195 {;} 03196 break; 03197 03198 case 56: 03199 #line 1097 "/build/buildd/llvm-1.8b/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 57: 03207 #line 1101 "/build/buildd/llvm-1.8b/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 59: 03216 #line 1114 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03217 { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} 03218 break; 03219 03220 case 61: 03221 #line 1115 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03222 { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} 03223 break; 03224 03225 case 62: 03226 #line 1117 "/build/buildd/llvm-1.8b/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 76: 03235 #line 1128 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03236 { 03237 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); 03238 ;} 03239 break; 03240 03241 case 77: 03242 #line 1131 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03243 { 03244 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); 03245 ;} 03246 break; 03247 03248 case 78: 03249 #line 1134 "/build/buildd/llvm-1.8b/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 79: 03256 #line 1140 "/build/buildd/llvm-1.8b/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 80: 03267 #line 1147 "/build/buildd/llvm-1.8b/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 81: 03283 #line 1159 "/build/buildd/llvm-1.8b/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 82: 03291 #line 1163 "/build/buildd/llvm-1.8b/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 83: 03306 #line 1174 "/build/buildd/llvm-1.8b/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 84: 03319 #line 1183 "/build/buildd/llvm-1.8b/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 85: 03326 #line 1186 "/build/buildd/llvm-1.8b/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 86: 03334 #line 1194 "/build/buildd/llvm-1.8b/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 87: 03342 #line 1198 "/build/buildd/llvm-1.8b/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 89: 03349 #line 1204 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03350 { 03351 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(Type::VoidTy); 03352 ;} 03353 break; 03354 03355 case 90: 03356 #line 1207 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03357 { 03358 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy); 03359 ;} 03360 break; 03361 03362 case 91: 03363 #line 1210 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03364 { 03365 (yyval.TypeList) = new std::list<PATypeHolder>(); 03366 ;} 03367 break; 03368 03369 case 92: 03370 #line 1220 "/build/buildd/llvm-1.8b/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 93: 03399 #line 1245 "/build/buildd/llvm-1.8b/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 94: 03416 #line 1258 "/build/buildd/llvm-1.8b/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 95: 03449 #line 1287 "/build/buildd/llvm-1.8b/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 96: 03478 #line 1312 "/build/buildd/llvm-1.8b/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 97: 03502 #line 1332 "/build/buildd/llvm-1.8b/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 98: 03518 #line 1344 "/build/buildd/llvm-1.8b/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 99: 03531 #line 1353 "/build/buildd/llvm-1.8b/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 100: 03539 #line 1357 "/build/buildd/llvm-1.8b/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 101: 03602 #line 1416 "/build/buildd/llvm-1.8b/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 102: 03612 #line 1422 "/build/buildd/llvm-1.8b/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 103: 03623 #line 1430 "/build/buildd/llvm-1.8b/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 104: 03632 #line 1435 "/build/buildd/llvm-1.8b/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 105: 03641 #line 1440 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03642 { // Boolean constants 03643 (yyval.ConstVal) = ConstantBool::True; 03644 ;} 03645 break; 03646 03647 case 106: 03648 #line 1443 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03649 { // Boolean constants 03650 (yyval.ConstVal) = ConstantBool::False; 03651 ;} 03652 break; 03653 03654 case 107: 03655 #line 1446 "/build/buildd/llvm-1.8b/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 108: 03664 #line 1453 "/build/buildd/llvm-1.8b/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 109: 03678 #line 1463 "/build/buildd/llvm-1.8b/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 110: 03713 #line 1494 "/build/buildd/llvm-1.8b/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 111: 03724 #line 1501 "/build/buildd/llvm-1.8b/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 112: 03749 #line 1522 "/build/buildd/llvm-1.8b/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 113: 03763 #line 1532 "/build/buildd/llvm-1.8b/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 114: 03772 #line 1537 "/build/buildd/llvm-1.8b/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 115: 03783 #line 1544 "/build/buildd/llvm-1.8b/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 116: 03792 #line 1549 "/build/buildd/llvm-1.8b/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 117: 03801 #line 1554 "/build/buildd/llvm-1.8b/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 118: 03810 #line 1562 "/build/buildd/llvm-1.8b/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 119: 03817 #line 1565 "/build/buildd/llvm-1.8b/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 120: 03825 #line 1572 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03826 { (yyval.BoolVal) = false; ;} 03827 break; 03828 03829 case 121: 03830 #line 1572 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03831 { (yyval.BoolVal) = true; ;} 03832 break; 03833 03834 case 122: 03835 #line 1582 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03836 { 03837 (yyval.ModuleVal) = ParserResult = (yyvsp[(1) - (1)].ModuleVal); 03838 CurModule.ModuleDone(); 03839 ;} 03840 break; 03841 03842 case 123: 03843 #line 1589 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03844 { 03845 (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); 03846 CurFun.FunctionDone(); 03847 ;} 03848 break; 03849 03850 case 124: 03851 #line 1593 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03852 { 03853 (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); 03854 ;} 03855 break; 03856 03857 case 125: 03858 #line 1596 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03859 { 03860 (yyval.ModuleVal) = (yyvsp[(1) - (4)].ModuleVal); 03861 ;} 03862 break; 03863 03864 case 126: 03865 #line 1599 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03866 { 03867 (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); 03868 ;} 03869 break; 03870 03871 case 127: 03872 #line 1602 "/build/buildd/llvm-1.8b/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 128: 03887 #line 1615 "/build/buildd/llvm-1.8b/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 129: 03911 #line 1635 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03912 { // Function prototypes can be in const pool 03913 ;} 03914 break; 03915 03916 case 130: 03917 #line 1637 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03918 { // Asm blocks can be in the const pool 03919 ;} 03920 break; 03921 03922 case 131: 03923 #line 1639 "/build/buildd/llvm-1.8b/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 132: 03931 #line 1642 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03932 { 03933 CurGV = 0; 03934 ;} 03935 break; 03936 03937 case 133: 03938 #line 1645 "/build/buildd/llvm-1.8b/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 134: 03947 #line 1649 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03948 { 03949 CurGV = 0; 03950 ;} 03951 break; 03952 03953 case 135: 03954 #line 1652 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03955 { 03956 ;} 03957 break; 03958 03959 case 136: 03960 #line 1654 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03961 { 03962 ;} 03963 break; 03964 03965 case 137: 03966 #line 1656 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03967 { 03968 ;} 03969 break; 03970 03971 case 138: 03972 #line 1660 "/build/buildd/llvm-1.8b/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 139: 03987 #line 1672 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03988 { (yyval.Endianness) = Module::BigEndian; ;} 03989 break; 03990 03991 case 140: 03992 #line 1673 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03993 { (yyval.Endianness) = Module::LittleEndian; ;} 03994 break; 03995 03996 case 141: 03997 #line 1675 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 03998 { 03999 CurModule.CurrentModule->setEndianness((yyvsp[(3) - (3)].Endianness)); 04000 ;} 04001 break; 04002 04003 case 142: 04004 #line 1678 "/build/buildd/llvm-1.8b/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 143: 04016 #line 1686 "/build/buildd/llvm-1.8b/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 145: 04024 #line 1693 "/build/buildd/llvm-1.8b/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 146: 04032 #line 1697 "/build/buildd/llvm-1.8b/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 147: 04040 #line 1701 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04041 { 04042 ;} 04043 break; 04044 04045 case 151: 04046 #line 1710 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04047 { (yyval.StrVal) = 0; ;} 04048 break; 04049 04050 case 152: 04051 #line 1712 "/build/buildd/llvm-1.8b/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 153: 04060 #line 1718 "/build/buildd/llvm-1.8b/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 154: 04069 #line 1723 "/build/buildd/llvm-1.8b/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 155: 04078 #line 1729 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04079 { 04080 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); 04081 ;} 04082 break; 04083 04084 case 156: 04085 #line 1732 "/build/buildd/llvm-1.8b/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 157: 04094 #line 1737 "/build/buildd/llvm-1.8b/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 158: 04102 #line 1741 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04103 { 04104 (yyval.ArgList) = 0; 04105 ;} 04106 break; 04107 04108 case 159: 04109 #line 1746 "/build/buildd/llvm-1.8b/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 162: 04197 #line 1833 "/build/buildd/llvm-1.8b/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 165: 04208 #line 1843 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04209 { 04210 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); 04211 ;} 04212 break; 04213 04214 case 166: 04215 #line 1847 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04216 { CurFun.isDeclare = true; ;} 04217 break; 04218 04219 case 167: 04220 #line 1847 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04221 { 04222 (yyval.FunctionVal) = CurFun.CurrentFunction; 04223 CurFun.FunctionDone(); 04224 ;} 04225 break; 04226 04227 case 168: 04228 #line 1856 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04229 { 04230 (yyval.BoolVal) = false; 04231 ;} 04232 break; 04233 04234 case 169: 04235 #line 1859 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04236 { 04237 (yyval.BoolVal) = true; 04238 ;} 04239 break; 04240 04241 case 170: 04242 #line 1863 "/build/buildd/llvm-1.8b/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 171: 04249 #line 1866 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04250 { 04251 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); 04252 ;} 04253 break; 04254 04255 case 172: 04256 #line 1869 "/build/buildd/llvm-1.8b/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 173: 04263 #line 1872 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04264 { 04265 (yyval.ValIDVal) = ValID::create(ConstantBool::True); 04266 ;} 04267 break; 04268 04269 case 174: 04270 #line 1875 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04271 { 04272 (yyval.ValIDVal) = ValID::create(ConstantBool::False); 04273 ;} 04274 break; 04275 04276 case 175: 04277 #line 1878 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04278 { 04279 (yyval.ValIDVal) = ValID::createNull(); 04280 ;} 04281 break; 04282 04283 case 176: 04284 #line 1881 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04285 { 04286 (yyval.ValIDVal) = ValID::createUndef(); 04287 ;} 04288 break; 04289 04290 case 177: 04291 #line 1884 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04292 { // A vector zero constant. 04293 (yyval.ValIDVal) = ValID::createZeroInit(); 04294 ;} 04295 break; 04296 04297 case 178: 04298 #line 1887 "/build/buildd/llvm-1.8b/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 179: 04326 #line 1911 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04327 { 04328 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); 04329 ;} 04330 break; 04331 04332 case 180: 04333 #line 1914 "/build/buildd/llvm-1.8b/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 181: 04346 #line 1927 "/build/buildd/llvm-1.8b/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 182: 04353 #line 1930 "/build/buildd/llvm-1.8b/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 185: 04360 #line 1941 "/build/buildd/llvm-1.8b/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 186: 04367 #line 1945 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04368 { 04369 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); 04370 ;} 04371 break; 04372 04373 case 187: 04374 #line 1948 "/build/buildd/llvm-1.8b/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 188: 04381 #line 1956 "/build/buildd/llvm-1.8b/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 189: 04393 #line 1965 "/build/buildd/llvm-1.8b/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 190: 04401 #line 1969 "/build/buildd/llvm-1.8b/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 191: 04415 #line 1979 "/build/buildd/llvm-1.8b/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 192: 04429 #line 1990 "/build/buildd/llvm-1.8b/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 193: 04436 #line 1993 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04437 { // Return with no result... 04438 (yyval.TermInstVal) = new ReturnInst(); 04439 ;} 04440 break; 04441 04442 case 194: 04443 #line 1996 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04444 { // Unconditional Branch... 04445 (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[(3) - (3)].ValIDVal))); 04446 ;} 04447 break; 04448 04449 case 195: 04450 #line 1999 "/build/buildd/llvm-1.8b/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 196: 04457 #line 2002 "/build/buildd/llvm-1.8b/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 197: 04475 #line 2016 "/build/buildd/llvm-1.8b/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 198: 04483 #line 2021 "/build/buildd/llvm-1.8b/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 199: 04539 #line 2073 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04540 { 04541 (yyval.TermInstVal) = new UnwindInst(); 04542 ;} 04543 break; 04544 04545 case 200: 04546 #line 2076 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04547 { 04548 (yyval.TermInstVal) = new UnreachableInst(); 04549 ;} 04550 break; 04551 04552 case 201: 04553 #line 2082 "/build/buildd/llvm-1.8b/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 202: 04565 #line 2090 "/build/buildd/llvm-1.8b/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 203: 04578 #line 2100 "/build/buildd/llvm-1.8b/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 204: 04588 #line 2107 "/build/buildd/llvm-1.8b/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 205: 04597 #line 2112 "/build/buildd/llvm-1.8b/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 206: 04606 #line 2119 "/build/buildd/llvm-1.8b/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 207: 04614 #line 2123 "/build/buildd/llvm-1.8b/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 209: 04622 #line 2129 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04623 { (yyval.ValueList) = 0; ;} 04624 break; 04625 04626 case 210: 04627 #line 2131 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04628 { 04629 (yyval.BoolVal) = true; 04630 ;} 04631 break; 04632 04633 case 211: 04634 #line 2134 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04635 { 04636 (yyval.BoolVal) = false; 04637 ;} 04638 break; 04639 04640 case 212: 04641 #line 2140 "/build/buildd/llvm-1.8b/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 213: 04657 #line 2152 "/build/buildd/llvm-1.8b/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 214: 04672 #line 2163 "/build/buildd/llvm-1.8b/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 215: 04686 #line 2173 "/build/buildd/llvm-1.8b/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 216: 04702 #line 2185 "/build/buildd/llvm-1.8b/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 217: 04713 #line 2192 "/build/buildd/llvm-1.8b/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 218: 04724 #line 2199 "/build/buildd/llvm-1.8b/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 219: 04735 #line 2206 "/build/buildd/llvm-1.8b/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 220: 04744 #line 2211 "/build/buildd/llvm-1.8b/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 221: 04767 #line 2230 "/build/buildd/llvm-1.8b/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 222: 04793 #line 2252 "/build/buildd/llvm-1.8b/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 223: 04802 #line 2257 "/build/buildd/llvm-1.8b/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 224: 04811 #line 2262 "/build/buildd/llvm-1.8b/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 225: 04820 #line 2267 "/build/buildd/llvm-1.8b/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 226: 04838 #line 2281 "/build/buildd/llvm-1.8b/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 227: 04899 #line 2338 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04900 { 04901 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); 04902 ;} 04903 break; 04904 04905 case 228: 04906 #line 2344 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04907 { 04908 (yyval.ValueList) = (yyvsp[(2) - (2)].ValueList); 04909 ;} 04910 break; 04911 04912 case 229: 04913 #line 2346 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04914 { 04915 (yyval.ValueList) = new std::vector<Value*>(); 04916 ;} 04917 break; 04918 04919 case 230: 04920 #line 2350 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04921 { 04922 (yyval.BoolVal) = true; 04923 ;} 04924 break; 04925 04926 case 231: 04927 #line 2353 "/build/buildd/llvm-1.8b/llvm/lib/AsmParser/llvmAsmParser.y" 04928 { 04929 (yyval.BoolVal) = false; 04930 ;} 04931 break; 04932 04933 case 232: 04934 #line 2359 "/build/buildd/llvm-1.8b/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 233: 04942 #line 2363 "/build/buildd/llvm-1.8b/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 234: 04950 #line 2367 "/build/buildd/llvm-1.8b/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 235: 04958 #line 2371 "/build/buildd/llvm-1.8b/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 236: 04966 #line 2375 "/build/buildd/llvm-1.8b/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 237: 04976 #line 2382 "/build/buildd/llvm-1.8b/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 238: 04990 #line 2392 "/build/buildd/llvm-1.8b/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 239: 05007 #line 2405 "/build/buildd/llvm-1.8b/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 2428 "/build/buildd/llvm-1.8b/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