Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2 | /* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y |
| 3 | by GNU Bison version 1.28 */ |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 5 | #define YYBISON 1 /* Identify Bison output. */ |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 6 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7 | #define yyparse llvmAsmparse |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 8 | #define yylex llvmAsmlex |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 9 | #define yyerror llvmAsmerror |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 10 | #define yylval llvmAsmlval |
| 11 | #define yychar llvmAsmchar |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 12 | #define yydebug llvmAsmdebug |
| 13 | #define yynerrs llvmAsmnerrs |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 14 | #define ESINT64VAL 257 |
| 15 | #define EUINT64VAL 258 |
| 16 | #define LOCALVAL_ID 259 |
| 17 | #define GLOBALVAL_ID 260 |
| 18 | #define FPVAL 261 |
| 19 | #define VOID 262 |
| 20 | #define INTTYPE 263 |
| 21 | #define FLOAT 264 |
| 22 | #define DOUBLE 265 |
| 23 | #define LABEL 266 |
| 24 | #define TYPE 267 |
| 25 | #define LOCALVAR 268 |
| 26 | #define GLOBALVAR 269 |
| 27 | #define LABELSTR 270 |
| 28 | #define STRINGCONSTANT 271 |
| 29 | #define ATSTRINGCONSTANT 272 |
| 30 | #define IMPLEMENTATION 273 |
| 31 | #define ZEROINITIALIZER 274 |
| 32 | #define TRUETOK 275 |
| 33 | #define FALSETOK 276 |
| 34 | #define BEGINTOK 277 |
| 35 | #define ENDTOK 278 |
| 36 | #define DECLARE 279 |
| 37 | #define DEFINE 280 |
| 38 | #define GLOBAL 281 |
| 39 | #define CONSTANT 282 |
| 40 | #define SECTION 283 |
| 41 | #define VOLATILE 284 |
| 42 | #define TO 285 |
| 43 | #define DOTDOTDOT 286 |
| 44 | #define NULL_TOK 287 |
| 45 | #define UNDEF 288 |
| 46 | #define INTERNAL 289 |
| 47 | #define LINKONCE 290 |
| 48 | #define WEAK 291 |
| 49 | #define APPENDING 292 |
| 50 | #define DLLIMPORT 293 |
| 51 | #define DLLEXPORT 294 |
| 52 | #define EXTERN_WEAK 295 |
| 53 | #define OPAQUE 296 |
| 54 | #define EXTERNAL 297 |
| 55 | #define TARGET 298 |
| 56 | #define TRIPLE 299 |
| 57 | #define ALIGN 300 |
| 58 | #define DEPLIBS 301 |
| 59 | #define CALL 302 |
| 60 | #define TAIL 303 |
| 61 | #define ASM_TOK 304 |
| 62 | #define MODULE 305 |
| 63 | #define SIDEEFFECT 306 |
| 64 | #define CC_TOK 307 |
| 65 | #define CCC_TOK 308 |
| 66 | #define FASTCC_TOK 309 |
| 67 | #define COLDCC_TOK 310 |
| 68 | #define X86_STDCALLCC_TOK 311 |
| 69 | #define X86_FASTCALLCC_TOK 312 |
| 70 | #define DATALAYOUT 313 |
| 71 | #define RET 314 |
| 72 | #define BR 315 |
| 73 | #define SWITCH 316 |
| 74 | #define INVOKE 317 |
| 75 | #define UNWIND 318 |
| 76 | #define UNREACHABLE 319 |
| 77 | #define ADD 320 |
| 78 | #define SUB 321 |
| 79 | #define MUL 322 |
| 80 | #define UDIV 323 |
| 81 | #define SDIV 324 |
| 82 | #define FDIV 325 |
| 83 | #define UREM 326 |
| 84 | #define SREM 327 |
| 85 | #define FREM 328 |
| 86 | #define AND 329 |
| 87 | #define OR 330 |
| 88 | #define XOR 331 |
| 89 | #define ICMP 332 |
| 90 | #define FCMP 333 |
| 91 | #define EQ 334 |
| 92 | #define NE 335 |
| 93 | #define SLT 336 |
| 94 | #define SGT 337 |
| 95 | #define SLE 338 |
| 96 | #define SGE 339 |
| 97 | #define ULT 340 |
| 98 | #define UGT 341 |
| 99 | #define ULE 342 |
| 100 | #define UGE 343 |
| 101 | #define OEQ 344 |
| 102 | #define ONE 345 |
| 103 | #define OLT 346 |
| 104 | #define OGT 347 |
| 105 | #define OLE 348 |
| 106 | #define OGE 349 |
| 107 | #define ORD 350 |
| 108 | #define UNO 351 |
| 109 | #define UEQ 352 |
| 110 | #define UNE 353 |
| 111 | #define MALLOC 354 |
| 112 | #define ALLOCA 355 |
| 113 | #define FREE 356 |
| 114 | #define LOAD 357 |
| 115 | #define STORE 358 |
| 116 | #define GETELEMENTPTR 359 |
| 117 | #define TRUNC 360 |
| 118 | #define ZEXT 361 |
| 119 | #define SEXT 362 |
| 120 | #define FPTRUNC 363 |
| 121 | #define FPEXT 364 |
| 122 | #define BITCAST 365 |
| 123 | #define UITOFP 366 |
| 124 | #define SITOFP 367 |
| 125 | #define FPTOUI 368 |
| 126 | #define FPTOSI 369 |
| 127 | #define INTTOPTR 370 |
| 128 | #define PTRTOINT 371 |
| 129 | #define PHI_TOK 372 |
| 130 | #define SELECT 373 |
| 131 | #define SHL 374 |
| 132 | #define LSHR 375 |
| 133 | #define ASHR 376 |
| 134 | #define VAARG 377 |
| 135 | #define EXTRACTELEMENT 378 |
| 136 | #define INSERTELEMENT 379 |
| 137 | #define SHUFFLEVECTOR 380 |
| 138 | #define NORETURN 381 |
| 139 | #define INREG 382 |
| 140 | #define SRET 383 |
| 141 | #define DEFAULT 384 |
| 142 | #define HIDDEN 385 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 143 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 144 | #line 14 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 145 | |
| 146 | #include "ParserInternals.h" |
| 147 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 148 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 149 | #include "llvm/Instructions.h" |
| 150 | #include "llvm/Module.h" |
| 151 | #include "llvm/SymbolTable.h" |
| 152 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 153 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 154 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 155 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 156 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 157 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 158 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 159 | #include <list> |
| 160 | #include <utility> |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 161 | #ifndef NDEBUG |
| 162 | #define YYDEBUG 1 |
| 163 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 164 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 165 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 166 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 167 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 168 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 169 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 170 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 171 | // GenerateError are made from inside productions and they must simulate the |
| 172 | // previous exception behavior by exiting the production immediately. We have |
| 173 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 174 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 175 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 176 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 177 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 178 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 179 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 180 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 181 | int yylex(); // declaration" of xxx warnings. |
| 182 | int yyparse(); |
| 183 | |
| 184 | namespace llvm { |
| 185 | std::string CurFilename; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 186 | #if YYDEBUG |
| 187 | static cl::opt<bool> |
| 188 | Debug("debug-yacc", cl::desc("Print yacc debug state changes"), |
| 189 | cl::Hidden, cl::init(false)); |
| 190 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 191 | } |
| 192 | using namespace llvm; |
| 193 | |
| 194 | static Module *ParserResult; |
| 195 | |
| 196 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 197 | // relating to upreferences in the input stream. |
| 198 | // |
| 199 | //#define DEBUG_UPREFS 1 |
| 200 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 201 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 202 | #else |
| 203 | #define UR_OUT(X) |
| 204 | #endif |
| 205 | |
| 206 | #define YYERROR_VERBOSE 1 |
| 207 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 208 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 209 | |
| 210 | |
| 211 | // This contains info used when building the body of a function. It is |
| 212 | // destroyed when the function is completed. |
| 213 | // |
| 214 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 215 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 216 | static void |
| 217 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 218 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 219 | |
| 220 | static struct PerModuleInfo { |
| 221 | Module *CurrentModule; |
| 222 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 223 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 224 | std::vector<PATypeHolder> Types; |
| 225 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 226 | |
| 227 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 228 | /// how they were referenced and on which line of the input they came from so |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 229 | /// that we can resolve them later and print error messages as appropriate. |
| 230 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 231 | |
| 232 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 233 | // references to global values. Global values may be referenced before they |
| 234 | // are defined, and if so, the temporary object that they represent is held |
| 235 | // here. This is used for forward references of GlobalValues. |
| 236 | // |
| 237 | typedef std::map<std::pair<const PointerType *, |
| 238 | ValID>, GlobalValue*> GlobalRefsType; |
| 239 | GlobalRefsType GlobalRefs; |
| 240 | |
| 241 | void ModuleDone() { |
| 242 | // If we could not resolve some functions at function compilation time |
| 243 | // (calls to functions before they are defined), resolve them now... Types |
| 244 | // are resolved when the constant pool has been completely parsed. |
| 245 | // |
| 246 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 247 | if (TriggerError) |
| 248 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 249 | |
| 250 | // Check to make sure that all global value forward references have been |
| 251 | // resolved! |
| 252 | // |
| 253 | if (!GlobalRefs.empty()) { |
| 254 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 255 | |
| 256 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 257 | I != E; ++I) { |
| 258 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 259 | I->first.second.getName() + "\n"; |
| 260 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 261 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 262 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | Values.clear(); // Clear out function local definitions |
| 266 | Types.clear(); |
| 267 | CurrentModule = 0; |
| 268 | } |
| 269 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 270 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 271 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 272 | // If not, just return null. |
| 273 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 274 | // Check to see if there is a forward reference to this global variable... |
| 275 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 276 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 277 | GlobalValue *Ret = 0; |
| 278 | if (I != GlobalRefs.end()) { |
| 279 | Ret = I->second; |
| 280 | GlobalRefs.erase(I); |
| 281 | } |
| 282 | return Ret; |
| 283 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 284 | |
| 285 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 286 | // If it isn't abstract, its resolved |
| 287 | const Type* Ty = PATy->get(); |
| 288 | if (!Ty->isAbstract()) |
| 289 | return false; |
| 290 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 291 | // we don't need to traverse that leg of the type. |
| 292 | std::vector<const Type*> WorkList, SeenList; |
| 293 | WorkList.push_back(Ty); |
| 294 | while (!WorkList.empty()) { |
| 295 | const Type* Ty = WorkList.back(); |
| 296 | SeenList.push_back(Ty); |
| 297 | WorkList.pop_back(); |
| 298 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 299 | // Check to see if this is an unresolved type |
| 300 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 301 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 302 | for ( ; I != E; ++I) { |
| 303 | if (I->second.get() == OpTy) |
| 304 | return true; |
| 305 | } |
| 306 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 307 | const Type* TheTy = SeqTy->getElementType(); |
| 308 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 309 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 310 | E = SeenList.end(); |
| 311 | for ( ; I != E; ++I) |
| 312 | if (*I == TheTy) |
| 313 | break; |
| 314 | if (I == E) |
| 315 | WorkList.push_back(TheTy); |
| 316 | } |
| 317 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 318 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 319 | const Type* TheTy = StrTy->getElementType(i); |
| 320 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 321 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 322 | E = SeenList.end(); |
| 323 | for ( ; I != E; ++I) |
| 324 | if (*I == TheTy) |
| 325 | break; |
| 326 | if (I == E) |
| 327 | WorkList.push_back(TheTy); |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | return false; |
| 333 | } |
| 334 | |
| 335 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 336 | } CurModule; |
| 337 | |
| 338 | static struct PerFunctionInfo { |
| 339 | Function *CurrentFunction; // Pointer to current function being created |
| 340 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 341 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 342 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 343 | bool isDeclare; // Is this function a forward declararation? |
| 344 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 345 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 346 | |
| 347 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 348 | /// track of them here. |
| 349 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 350 | std::vector<BasicBlock*> NumberedBlocks; |
| 351 | unsigned NextBBNum; |
| 352 | |
| 353 | inline PerFunctionInfo() { |
| 354 | CurrentFunction = 0; |
| 355 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 356 | Linkage = GlobalValue::ExternalLinkage; |
| 357 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | inline void FunctionStart(Function *M) { |
| 361 | CurrentFunction = M; |
| 362 | NextBBNum = 0; |
| 363 | } |
| 364 | |
| 365 | void FunctionDone() { |
| 366 | NumberedBlocks.clear(); |
| 367 | |
| 368 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 369 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 370 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 371 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 372 | return; |
| 373 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 374 | |
| 375 | // Resolve all forward references now. |
| 376 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 377 | |
| 378 | Values.clear(); // Clear out function local definitions |
| 379 | CurrentFunction = 0; |
| 380 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 381 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 382 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 383 | } |
| 384 | } CurFun; // Info for the current function... |
| 385 | |
| 386 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 387 | |
| 388 | |
| 389 | //===----------------------------------------------------------------------===// |
| 390 | // Code to handle definitions of all the types |
| 391 | //===----------------------------------------------------------------------===// |
| 392 | |
| 393 | static int InsertValue(Value *V, |
| 394 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 395 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 396 | |
| 397 | // Yes, insert the value into the value table... |
| 398 | ValueList &List = ValueTab[V->getType()]; |
| 399 | List.push_back(V); |
| 400 | return List.size()-1; |
| 401 | } |
| 402 | |
| 403 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 404 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 405 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 406 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 407 | if (D.Num < CurModule.Types.size()) |
| 408 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 409 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 410 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 411 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 412 | D.destroy(); // Free old strdup'd memory... |
| 413 | return N; |
| 414 | } |
| 415 | break; |
| 416 | default: |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 417 | GenerateError("Internal parser error: Invalid symbol type reference!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 418 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | // If we reached here, we referenced either a symbol that we don't know about |
| 422 | // or an id number that hasn't been read yet. We may be referencing something |
| 423 | // forward, so just create an entry to be resolved later and get to it... |
| 424 | // |
| 425 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 426 | |
| 427 | |
| 428 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 429 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 430 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 431 | return 0; |
| 432 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 433 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 434 | return 0; |
| 435 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 436 | } |
| 437 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 438 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 439 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 440 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 441 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 442 | Type *Typ = OpaqueType::get(); |
| 443 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 444 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 445 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 446 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 447 | // getValNonImprovising - Look up the value specified by the provided type and |
| 448 | // the provided ValID. If the value exists and has already been defined, return |
| 449 | // it. Otherwise return null. |
| 450 | // |
| 451 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 452 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 453 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 454 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 455 | return 0; |
| 456 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 457 | |
| 458 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 459 | case ValID::LocalID: { // Is it a numbered definition? |
| 460 | // Module constants occupy the lowest numbered slots. |
| 461 | std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty); |
| 462 | // Make sure that our type is within bounds. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 463 | if (VI == CurFun.Values.end()) return 0; |
| 464 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 465 | // Check that the number is within bounds. |
| 466 | if (D.Num >= VI->second.size()) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 467 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 468 | return VI->second[D.Num]; |
| 469 | } |
| 470 | case ValID::GlobalID: { // Is it a numbered definition? |
| 471 | unsigned Num = D.Num; |
| 472 | |
| 473 | // Module constants occupy the lowest numbered slots... |
| 474 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 475 | if (VI == CurModule.Values.end()) return 0; |
| 476 | if (D.Num >= VI->second.size()) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 477 | return VI->second[Num]; |
| 478 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 479 | |
| 480 | case ValID::LocalName: { // Is it a named definition? |
| 481 | if (!inFunctionScope()) return 0; |
| 482 | SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
| 483 | Value *N = SymTab.lookup(Ty, D.Name); |
| 484 | if (N == 0) return 0; |
| 485 | |
| 486 | D.destroy(); // Free old strdup'd memory... |
| 487 | return N; |
| 488 | } |
| 489 | case ValID::GlobalName: { // Is it a named definition? |
| 490 | SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
| 491 | Value *N = SymTab.lookup(Ty, D.Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 492 | if (N == 0) return 0; |
| 493 | |
| 494 | D.destroy(); // Free old strdup'd memory... |
| 495 | return N; |
| 496 | } |
| 497 | |
| 498 | // Check to make sure that "Ty" is an integral type, and that our |
| 499 | // value will fit into the specified type... |
| 500 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 501 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 502 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 503 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 504 | Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 505 | return 0; |
| 506 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 507 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 508 | |
| 509 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 510 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 511 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 512 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 513 | "' is invalid or out of range!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 514 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 515 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 516 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 517 | } |
| 518 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 519 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 520 | } |
| 521 | |
| 522 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 523 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 524 | GenerateError("FP constant invalid for type!!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 525 | return 0; |
| 526 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 527 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 528 | |
| 529 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 530 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 531 | GenerateError("Cannot create a a non pointer null!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 532 | return 0; |
| 533 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 534 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 535 | |
| 536 | case ValID::ConstUndefVal: // Is it an undef value? |
| 537 | return UndefValue::get(Ty); |
| 538 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 539 | case ValID::ConstZeroVal: // Is it a zero value? |
| 540 | return Constant::getNullValue(Ty); |
| 541 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 542 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 543 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 544 | GenerateError("Constant expression type different from required type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 545 | return 0; |
| 546 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 547 | return D.ConstantValue; |
| 548 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 549 | case ValID::InlineAsmVal: { // Inline asm expression |
| 550 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 551 | const FunctionType *FTy = |
| 552 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 553 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 554 | GenerateError("Invalid type for asm constraint string!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 555 | return 0; |
| 556 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 557 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 558 | D.IAD->HasSideEffects); |
| 559 | D.destroy(); // Free InlineAsmDescriptor. |
| 560 | return IA; |
| 561 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 562 | default: |
| 563 | assert(0 && "Unhandled case!"); |
| 564 | return 0; |
| 565 | } // End of switch |
| 566 | |
| 567 | assert(0 && "Unhandled case!"); |
| 568 | return 0; |
| 569 | } |
| 570 | |
| 571 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 572 | // value is not already defined, it "improvises" by creating a placeholder var |
| 573 | // that looks and acts just like the requested variable. When the value is |
| 574 | // defined later, all uses of the placeholder variable are replaced with the |
| 575 | // real thing. |
| 576 | // |
| 577 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 578 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 579 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 580 | return 0; |
| 581 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 582 | |
| 583 | // See if the value has already been defined. |
| 584 | Value *V = getValNonImprovising(Ty, ID); |
| 585 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 586 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 587 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 588 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 589 | GenerateError("Invalid use of a composite type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 590 | return 0; |
| 591 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 592 | |
| 593 | // If we reached here, we referenced either a symbol that we don't know about |
| 594 | // or an id number that hasn't been read yet. We may be referencing something |
| 595 | // forward, so just create an entry to be resolved later and get to it... |
| 596 | // |
| 597 | V = new Argument(Ty); |
| 598 | |
| 599 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 600 | // to recycle these things?? |
| 601 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 602 | llvmAsmlineno))); |
| 603 | |
| 604 | if (inFunctionScope()) |
| 605 | InsertValue(V, CurFun.LateResolveValues); |
| 606 | else |
| 607 | InsertValue(V, CurModule.LateResolveValues); |
| 608 | return V; |
| 609 | } |
| 610 | |
| 611 | /// getBBVal - This is used for two purposes: |
| 612 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 613 | /// defined. |
| 614 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 615 | /// or may not be a forward reference. |
| 616 | /// |
| 617 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 618 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 619 | |
| 620 | std::string Name; |
| 621 | BasicBlock *BB = 0; |
| 622 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 623 | default: |
| 624 | GenerateError("Illegal label reference " + ID.getName()); |
| 625 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 626 | case ValID::LocalID: // Is it a numbered definition? |
| 627 | if (ID.Num >= CurFun.NumberedBlocks.size()) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 628 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 629 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 630 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 631 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 632 | Name = ID.Name; |
| 633 | if (Value *N = CurFun.CurrentFunction-> |
Reid Spencer | 78d033e | 2007-01-06 07:24:44 +0000 | [diff] [blame] | 634 | getValueSymbolTable().lookup(Type::LabelTy, Name)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 635 | BB = cast<BasicBlock>(N); |
| 636 | break; |
| 637 | } |
| 638 | |
| 639 | // See if the block has already been defined. |
| 640 | if (BB) { |
| 641 | // If this is the definition of the block, make sure the existing value was |
| 642 | // just a forward reference. If it was a forward reference, there will be |
| 643 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 644 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 645 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 646 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 647 | return 0; |
| 648 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 649 | |
| 650 | ID.destroy(); // Free strdup'd memory. |
| 651 | return BB; |
| 652 | } |
| 653 | |
| 654 | // Otherwise this block has not been seen before. |
| 655 | BB = new BasicBlock("", CurFun.CurrentFunction); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 656 | if (ID.Type == ValID::LocalName) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 657 | BB->setName(ID.Name); |
| 658 | } else { |
| 659 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 660 | } |
| 661 | |
| 662 | // If this is not a definition, keep track of it so we can use it as a forward |
| 663 | // reference. |
| 664 | if (!isDefinition) { |
| 665 | // Remember where this forward reference came from. |
| 666 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 667 | } else { |
| 668 | // The forward declaration could have been inserted anywhere in the |
| 669 | // function: insert it into the correct place now. |
| 670 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 671 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 672 | } |
| 673 | ID.destroy(); |
| 674 | return BB; |
| 675 | } |
| 676 | |
| 677 | |
| 678 | //===----------------------------------------------------------------------===// |
| 679 | // Code to handle forward references in instructions |
| 680 | //===----------------------------------------------------------------------===// |
| 681 | // |
| 682 | // This code handles the late binding needed with statements that reference |
| 683 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 684 | // a loop body. |
| 685 | // |
| 686 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 687 | // and back patchs after we are done. |
| 688 | // |
| 689 | |
| 690 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 691 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 692 | // defs now... |
| 693 | // |
| 694 | static void |
| 695 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 696 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 697 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 698 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 699 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 700 | ValueList &List = LRI->second; |
| 701 | while (!List.empty()) { |
| 702 | Value *V = List.back(); |
| 703 | List.pop_back(); |
| 704 | |
| 705 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 706 | CurModule.PlaceHolderInfo.find(V); |
| 707 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 708 | |
| 709 | ValID &DID = PHI->second.first; |
| 710 | |
| 711 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 712 | if (TriggerError) |
| 713 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 714 | if (TheRealValue) { |
| 715 | V->replaceAllUsesWith(TheRealValue); |
| 716 | delete V; |
| 717 | CurModule.PlaceHolderInfo.erase(PHI); |
| 718 | } else if (FutureLateResolvers) { |
| 719 | // Functions have their unresolved items forwarded to the module late |
| 720 | // resolver table |
| 721 | InsertValue(V, *FutureLateResolvers); |
| 722 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 723 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 724 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 725 | "' of type '" + V->getType()->getDescription() + "'", |
| 726 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 727 | return; |
| 728 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 729 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 730 | itostr(DID.Num) + " of type '" + |
| 731 | V->getType()->getDescription() + "'", |
| 732 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 733 | return; |
| 734 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 735 | } |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | LateResolvers.clear(); |
| 740 | } |
| 741 | |
| 742 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 743 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 744 | // refering to the number can be resolved. Do this now. |
| 745 | // |
| 746 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 747 | ValID D; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 748 | if (Name) D = ValID::createLocalName(Name); |
| 749 | else D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 750 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 751 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 752 | CurModule.LateResolveTypes.find(D); |
| 753 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 754 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 755 | CurModule.LateResolveTypes.erase(I); |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | // setValueName - Set the specified value to the name given. The name may be |
| 760 | // null potentially, in which case this is a noop. The string passed in is |
| 761 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 762 | // |
| 763 | static void setValueName(Value *V, char *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 764 | if (!NameStr) return; |
| 765 | std::string Name(NameStr); // Copy string |
| 766 | free(NameStr); // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 767 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 768 | if (V->getType() == Type::VoidTy) { |
| 769 | GenerateError("Can't assign name '" + Name+"' to value with void type!"); |
| 770 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 771 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 772 | |
| 773 | assert(inFunctionScope() && "Must be in function scope!"); |
| 774 | SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 775 | if (ST.lookup(V->getType(), Name)) { |
| 776 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
| 777 | V->getType()->getDescription() + "'!"); |
| 778 | return; |
| 779 | } |
| 780 | |
| 781 | // Set the name. |
| 782 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 786 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 787 | static GlobalVariable * |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 788 | ParseGlobalVariable(char *NameStr, |
| 789 | GlobalValue::LinkageTypes Linkage, |
| 790 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 791 | bool isConstantGlobal, const Type *Ty, |
| 792 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 793 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 794 | GenerateError("Cannot declare global vars of function type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 795 | return 0; |
| 796 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 797 | |
| 798 | const PointerType *PTy = PointerType::get(Ty); |
| 799 | |
| 800 | std::string Name; |
| 801 | if (NameStr) { |
| 802 | Name = NameStr; // Copy string |
| 803 | free(NameStr); // Free old string |
| 804 | } |
| 805 | |
| 806 | // See if this global value was forward referenced. If so, recycle the |
| 807 | // object. |
| 808 | ValID ID; |
| 809 | if (!Name.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 810 | ID = ValID::createGlobalName((char*)Name.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 811 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 812 | ID = ValID::createGlobalID(CurModule.Values[PTy].size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 813 | } |
| 814 | |
| 815 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 816 | // Move the global to the end of the list, from whereever it was |
| 817 | // previously inserted. |
| 818 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 819 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 820 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 821 | GV->setInitializer(Initializer); |
| 822 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 823 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 824 | GV->setConstant(isConstantGlobal); |
| 825 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 826 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 827 | } |
| 828 | |
| 829 | // If this global has a name, check to see if there is already a definition |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 830 | // of this global in the module. If so, it is an error. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 831 | if (!Name.empty()) { |
| 832 | // We are a simple redefinition of a value, check to see if it is defined |
| 833 | // the same as the old one. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 834 | if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 835 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 836 | "' of type '" + Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 837 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 838 | } |
| 839 | } |
| 840 | |
| 841 | // Otherwise there is no existing GV to use, create one now. |
| 842 | GlobalVariable *GV = |
| 843 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 844 | CurModule.CurrentModule); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 845 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 846 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 847 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 848 | } |
| 849 | |
| 850 | // setTypeName - Set the specified type to the name given. The name may be |
| 851 | // null potentially, in which case this is a noop. The string passed in is |
| 852 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 853 | // |
| 854 | // This function returns true if the type has already been defined, but is |
| 855 | // allowed to be redefined in the specified context. If the name is a new name |
| 856 | // for the type plane, it is inserted and false is returned. |
| 857 | static bool setTypeName(const Type *T, char *NameStr) { |
| 858 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 859 | if (NameStr == 0) return false; |
| 860 | |
| 861 | std::string Name(NameStr); // Copy string |
| 862 | free(NameStr); // Free old string |
| 863 | |
| 864 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 865 | if (T == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 866 | GenerateError("Can't assign name '" + Name + "' to the void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 867 | return false; |
| 868 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 869 | |
| 870 | // Set the type name, checking for conflicts as we do so. |
| 871 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 872 | |
| 873 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 874 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 875 | assert(Existing && "Conflict but no matching type?"); |
| 876 | |
| 877 | // There is only one case where this is allowed: when we are refining an |
| 878 | // opaque type. In this case, Existing will be an opaque type. |
| 879 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 880 | // We ARE replacing an opaque type! |
| 881 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 882 | return true; |
| 883 | } |
| 884 | |
| 885 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 886 | // the redefinition is identical to the original. This will be so if |
| 887 | // Existing and T point to the same Type object. In this one case we |
| 888 | // allow the equivalent redefinition. |
| 889 | if (Existing == T) return true; // Yes, it's equal. |
| 890 | |
| 891 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 892 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
| 893 | T->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 894 | } |
| 895 | |
| 896 | return false; |
| 897 | } |
| 898 | |
| 899 | //===----------------------------------------------------------------------===// |
| 900 | // Code for handling upreferences in type names... |
| 901 | // |
| 902 | |
| 903 | // TypeContains - Returns true if Ty directly contains E in it. |
| 904 | // |
| 905 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 906 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 907 | E) != Ty->subtype_end(); |
| 908 | } |
| 909 | |
| 910 | namespace { |
| 911 | struct UpRefRecord { |
| 912 | // NestingLevel - The number of nesting levels that need to be popped before |
| 913 | // this type is resolved. |
| 914 | unsigned NestingLevel; |
| 915 | |
| 916 | // LastContainedTy - This is the type at the current binding level for the |
| 917 | // type. Every time we reduce the nesting level, this gets updated. |
| 918 | const Type *LastContainedTy; |
| 919 | |
| 920 | // UpRefTy - This is the actual opaque type that the upreference is |
| 921 | // represented with. |
| 922 | OpaqueType *UpRefTy; |
| 923 | |
| 924 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 925 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 926 | }; |
| 927 | } |
| 928 | |
| 929 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 930 | static std::vector<UpRefRecord> UpRefs; |
| 931 | |
| 932 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 933 | /// called. It loops through the UpRefs vector, which is a list of the |
| 934 | /// currently active types. For each type, if the up reference is contained in |
| 935 | /// the newly completed type, we decrement the level count. When the level |
| 936 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 937 | /// thus we can complete the cycle. |
| 938 | /// |
| 939 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 940 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 941 | // nothing to resolve here. |
| 942 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 943 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 944 | PATypeHolder Ty(ty); |
| 945 | UR_OUT("Type '" << Ty->getDescription() << |
| 946 | "' newly formed. Resolving upreferences.\n" << |
| 947 | UpRefs.size() << " upreferences active!\n"); |
| 948 | |
| 949 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 950 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 951 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 952 | // this variable. |
| 953 | OpaqueType *TypeToResolve = 0; |
| 954 | |
| 955 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 956 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 957 | << UpRefs[i].second->getDescription() << ") = " |
| 958 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 959 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 960 | // Decrement level of upreference |
| 961 | unsigned Level = --UpRefs[i].NestingLevel; |
| 962 | UpRefs[i].LastContainedTy = Ty; |
| 963 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 964 | if (Level == 0) { // Upreference should be resolved! |
| 965 | if (!TypeToResolve) { |
| 966 | TypeToResolve = UpRefs[i].UpRefTy; |
| 967 | } else { |
| 968 | UR_OUT(" * Resolving upreference for " |
| 969 | << UpRefs[i].second->getDescription() << "\n"; |
| 970 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 971 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 972 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 973 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 974 | } |
| 975 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 976 | --i; // Do not skip the next element... |
| 977 | } |
| 978 | } |
| 979 | } |
| 980 | |
| 981 | if (TypeToResolve) { |
| 982 | UR_OUT(" * Resolving upreference for " |
| 983 | << UpRefs[i].second->getDescription() << "\n"; |
| 984 | std::string OldName = TypeToResolve->getDescription()); |
| 985 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 986 | } |
| 987 | |
| 988 | return Ty; |
| 989 | } |
| 990 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 991 | //===----------------------------------------------------------------------===// |
| 992 | // RunVMAsmParser - Define an interface to this parser |
| 993 | //===----------------------------------------------------------------------===// |
| 994 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 995 | static Module* RunParser(Module * M); |
| 996 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 997 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 998 | set_scan_file(F); |
| 999 | |
| 1000 | CurFilename = Filename; |
| 1001 | return RunParser(new Module(CurFilename)); |
| 1002 | } |
| 1003 | |
| 1004 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1005 | set_scan_string(AsmString); |
| 1006 | |
| 1007 | CurFilename = "from_memory"; |
| 1008 | if (M == NULL) { |
| 1009 | return RunParser(new Module (CurFilename)); |
| 1010 | } else { |
| 1011 | return RunParser(M); |
| 1012 | } |
| 1013 | } |
| 1014 | |
| 1015 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1016 | #line 886 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 1017 | typedef union { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1018 | llvm::Module *ModuleVal; |
| 1019 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1020 | llvm::BasicBlock *BasicBlockVal; |
| 1021 | llvm::TerminatorInst *TermInstVal; |
| 1022 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1023 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1024 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1025 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1026 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1027 | llvm::PATypeHolder *TypeVal; |
| 1028 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1029 | std::vector<llvm::Value*> *ValueList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1030 | llvm::ArgListType *ArgList; |
| 1031 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1032 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
| 1033 | llvm::ValueRefList *ValueRefList; |
| 1034 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1035 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1036 | std::list<std::pair<llvm::Value*, |
| 1037 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1038 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1039 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1040 | |
| 1041 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1042 | llvm::GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1043 | llvm::FunctionType::ParameterAttributes ParamAttrs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1044 | int64_t SInt64Val; |
| 1045 | uint64_t UInt64Val; |
| 1046 | int SIntVal; |
| 1047 | unsigned UIntVal; |
| 1048 | double FPVal; |
| 1049 | bool BoolVal; |
| 1050 | |
| 1051 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1052 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1053 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1054 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1055 | llvm::Instruction::TermOps TermOpVal; |
| 1056 | llvm::Instruction::MemoryOps MemOpVal; |
| 1057 | llvm::Instruction::CastOps CastOpVal; |
| 1058 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1059 | llvm::ICmpInst::Predicate IPredicate; |
| 1060 | llvm::FCmpInst::Predicate FPredicate; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1061 | } YYSTYPE; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1062 | #include <stdio.h> |
| 1063 | |
| 1064 | #ifndef __cplusplus |
| 1065 | #ifndef __STDC__ |
| 1066 | #define const |
| 1067 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1068 | #endif |
| 1069 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1070 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1071 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1072 | #define YYFINAL 567 |
| 1073 | #define YYFLAG -32768 |
| 1074 | #define YYNTBASE 146 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1075 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1076 | #define YYTRANSLATE(x) ((unsigned)(x) <= 385 ? yytranslate[x] : 224) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1077 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1078 | static const short yytranslate[] = { 0, |
| 1079 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1080 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1081 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1082 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 136, |
| 1083 | 137, 134, 2, 133, 2, 2, 2, 2, 2, 2, |
| 1084 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 141, |
| 1085 | 132, 142, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1086 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1087 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1088 | 138, 135, 140, 2, 2, 2, 2, 2, 145, 2, |
| 1089 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1090 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 139, |
| 1091 | 2, 2, 143, 2, 144, 2, 2, 2, 2, 2, |
| 1092 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1093 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1094 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1095 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1096 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1097 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1098 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1099 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1100 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1101 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1102 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1103 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1104 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, |
| 1105 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 1106 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
| 1107 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, |
| 1108 | 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, |
| 1109 | 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 1110 | 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, |
| 1111 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 1112 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 1113 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 1114 | 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, |
| 1115 | 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, |
| 1116 | 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 1117 | 127, 128, 129, 130, 131 |
| 1118 | }; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1119 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1120 | #if YYDEBUG != 0 |
| 1121 | static const short yyprhs[] = { 0, |
| 1122 | 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, |
| 1123 | 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, |
| 1124 | 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, |
| 1125 | 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, |
| 1126 | 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, |
| 1127 | 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, |
| 1128 | 119, 122, 123, 125, 127, 130, 131, 133, 135, 137, |
| 1129 | 139, 141, 143, 145, 147, 148, 150, 151, 153, 155, |
| 1130 | 156, 158, 160, 162, 164, 165, 167, 169, 171, 173, |
| 1131 | 175, 178, 180, 182, 184, 186, 187, 190, 192, 194, |
| 1132 | 195, 198, 199, 202, 203, 207, 210, 211, 213, 214, |
| 1133 | 218, 220, 223, 225, 227, 229, 231, 233, 235, 238, |
| 1134 | 240, 243, 249, 255, 261, 267, 271, 274, 280, 285, |
| 1135 | 288, 290, 292, 294, 298, 300, 304, 306, 307, 309, |
| 1136 | 313, 318, 322, 326, 331, 336, 340, 347, 353, 356, |
| 1137 | 359, 362, 365, 368, 371, 374, 377, 380, 383, 390, |
| 1138 | 396, 405, 412, 419, 427, 435, 442, 449, 458, 467, |
| 1139 | 471, 473, 475, 477, 479, 480, 482, 485, 486, 490, |
| 1140 | 491, 495, 499, 501, 505, 509, 510, 517, 518, 526, |
| 1141 | 527, 535, 538, 542, 544, 548, 552, 556, 560, 562, |
| 1142 | 563, 569, 573, 575, 579, 581, 582, 592, 594, 596, |
| 1143 | 601, 603, 605, 608, 612, 613, 615, 617, 619, 621, |
| 1144 | 623, 625, 627, 629, 631, 635, 637, 643, 645, 647, |
| 1145 | 649, 651, 653, 655, 658, 661, 664, 668, 671, 672, |
| 1146 | 674, 677, 680, 684, 694, 704, 713, 728, 730, 732, |
| 1147 | 739, 745, 748, 755, 763, 767, 773, 774, 775, 779, |
| 1148 | 782, 784, 790, 796, 803, 810, 815, 820, 827, 832, |
| 1149 | 837, 844, 851, 854, 863, 865, 867, 868, 872, 879, |
| 1150 | 883, 890, 893, 898, 905 |
| 1151 | }; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1152 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1153 | static const short yyrhs[] = { 66, |
| 1154 | 0, 67, 0, 68, 0, 69, 0, 70, 0, 71, |
| 1155 | 0, 72, 0, 73, 0, 74, 0, 75, 0, 76, |
| 1156 | 0, 77, 0, 106, 0, 107, 0, 108, 0, 109, |
| 1157 | 0, 110, 0, 111, 0, 112, 0, 113, 0, 114, |
| 1158 | 0, 115, 0, 116, 0, 117, 0, 120, 0, 121, |
| 1159 | 0, 122, 0, 80, 0, 81, 0, 82, 0, 83, |
| 1160 | 0, 84, 0, 85, 0, 86, 0, 87, 0, 88, |
| 1161 | 0, 89, 0, 90, 0, 91, 0, 92, 0, 93, |
| 1162 | 0, 94, 0, 95, 0, 96, 0, 97, 0, 98, |
| 1163 | 0, 99, 0, 86, 0, 87, 0, 88, 0, 89, |
| 1164 | 0, 21, 0, 22, 0, 9, 0, 10, 0, 11, |
| 1165 | 0, 14, 0, 17, 0, 154, 0, 0, 154, 132, |
| 1166 | 0, 0, 15, 0, 18, 0, 157, 132, 0, 0, |
| 1167 | 35, 0, 37, 0, 36, 0, 38, 0, 40, 0, |
| 1168 | 39, 0, 41, 0, 43, 0, 0, 131, 0, 0, |
| 1169 | 39, 0, 41, 0, 0, 35, 0, 36, 0, 37, |
| 1170 | 0, 40, 0, 0, 54, 0, 55, 0, 56, 0, |
| 1171 | 57, 0, 58, 0, 53, 4, 0, 107, 0, 108, |
| 1172 | 0, 128, 0, 129, 0, 0, 166, 165, 0, 127, |
| 1173 | 0, 165, 0, 0, 168, 167, 0, 0, 46, 4, |
| 1174 | 0, 0, 133, 46, 4, 0, 29, 17, 0, 0, |
| 1175 | 171, 0, 0, 133, 174, 173, 0, 171, 0, 46, |
| 1176 | 4, 0, 9, 0, 10, 0, 11, 0, 12, 0, |
| 1177 | 42, 0, 175, 0, 176, 134, 0, 208, 0, 135, |
| 1178 | 4, 0, 176, 136, 180, 137, 168, 0, 8, 136, |
| 1179 | 180, 137, 168, 0, 138, 4, 139, 176, 140, 0, |
| 1180 | 141, 4, 139, 176, 142, 0, 143, 181, 144, 0, |
| 1181 | 143, 144, 0, 141, 143, 181, 144, 142, 0, 141, |
| 1182 | 143, 144, 142, 0, 176, 166, 0, 176, 0, 8, |
| 1183 | 0, 177, 0, 179, 133, 177, 0, 179, 0, 179, |
| 1184 | 133, 32, 0, 32, 0, 0, 176, 0, 181, 133, |
| 1185 | 176, 0, 176, 138, 184, 140, 0, 176, 138, 140, |
| 1186 | 0, 176, 145, 17, 0, 176, 141, 184, 142, 0, |
| 1187 | 176, 143, 184, 144, 0, 176, 143, 144, 0, 176, |
| 1188 | 141, 143, 184, 144, 142, 0, 176, 141, 143, 144, |
| 1189 | 142, 0, 176, 33, 0, 176, 34, 0, 176, 208, |
| 1190 | 0, 176, 183, 0, 176, 20, 0, 152, 3, 0, |
| 1191 | 152, 4, 0, 9, 21, 0, 9, 22, 0, 153, |
| 1192 | 7, 0, 148, 136, 182, 31, 176, 137, 0, 105, |
| 1193 | 136, 182, 219, 137, 0, 119, 136, 182, 133, 182, |
| 1194 | 133, 182, 137, 0, 146, 136, 182, 133, 182, 137, |
| 1195 | 0, 147, 136, 182, 133, 182, 137, 0, 78, 150, |
| 1196 | 136, 182, 133, 182, 137, 0, 79, 151, 136, 182, |
| 1197 | 133, 182, 137, 0, 149, 136, 182, 133, 182, 137, |
| 1198 | 0, 124, 136, 182, 133, 182, 137, 0, 125, 136, |
| 1199 | 182, 133, 182, 133, 182, 137, 0, 126, 136, 182, |
| 1200 | 133, 182, 133, 182, 137, 0, 184, 133, 182, 0, |
| 1201 | 182, 0, 27, 0, 28, 0, 187, 0, 0, 188, |
| 1202 | 0, 187, 188, 0, 0, 26, 189, 204, 0, 0, |
| 1203 | 25, 190, 205, 0, 51, 50, 194, 0, 19, 0, |
| 1204 | 156, 13, 176, 0, 156, 13, 8, 0, 0, 158, |
| 1205 | 161, 185, 182, 191, 173, 0, 0, 158, 159, 161, |
| 1206 | 185, 182, 192, 173, 0, 0, 158, 160, 161, 185, |
| 1207 | 176, 193, 173, 0, 44, 195, 0, 47, 132, 196, |
| 1208 | 0, 17, 0, 45, 132, 17, 0, 59, 132, 17, |
| 1209 | 0, 138, 197, 140, 0, 197, 133, 17, 0, 17, |
| 1210 | 0, 0, 198, 133, 176, 166, 155, 0, 176, 166, |
| 1211 | 155, 0, 198, 0, 198, 133, 32, 0, 32, 0, |
| 1212 | 0, 164, 178, 157, 136, 199, 137, 168, 172, 169, |
| 1213 | 0, 23, 0, 143, 0, 163, 161, 200, 201, 0, |
| 1214 | 24, 0, 144, 0, 211, 203, 0, 162, 161, 200, |
| 1215 | 0, 0, 52, 0, 3, 0, 4, 0, 7, 0, |
| 1216 | 21, 0, 22, 0, 33, 0, 34, 0, 20, 0, |
| 1217 | 141, 184, 142, 0, 183, 0, 50, 206, 17, 133, |
| 1218 | 17, 0, 5, 0, 6, 0, 154, 0, 157, 0, |
| 1219 | 208, 0, 207, 0, 176, 209, 0, 211, 212, 0, |
| 1220 | 202, 212, 0, 213, 156, 214, 0, 213, 216, 0, |
| 1221 | 0, 16, 0, 60, 210, 0, 60, 8, 0, 61, |
| 1222 | 12, 209, 0, 61, 9, 209, 133, 12, 209, 133, |
| 1223 | 12, 209, 0, 62, 152, 209, 133, 12, 209, 138, |
| 1224 | 215, 140, 0, 62, 152, 209, 133, 12, 209, 138, |
| 1225 | 140, 0, 63, 164, 178, 209, 136, 218, 137, 168, |
| 1226 | 31, 12, 209, 64, 12, 209, 0, 64, 0, 65, |
| 1227 | 0, 215, 152, 207, 133, 12, 209, 0, 152, 207, |
| 1228 | 133, 12, 209, 0, 156, 221, 0, 176, 138, 209, |
| 1229 | 133, 209, 140, 0, 217, 133, 138, 209, 133, 209, |
| 1230 | 140, 0, 176, 209, 166, 0, 218, 133, 176, 209, |
| 1231 | 166, 0, 0, 0, 219, 133, 210, 0, 49, 48, |
| 1232 | 0, 48, 0, 146, 176, 209, 133, 209, 0, 147, |
| 1233 | 176, 209, 133, 209, 0, 78, 150, 176, 209, 133, |
| 1234 | 209, 0, 79, 151, 176, 209, 133, 209, 0, 149, |
| 1235 | 210, 133, 210, 0, 148, 210, 31, 176, 0, 119, |
| 1236 | 210, 133, 210, 133, 210, 0, 123, 210, 133, 176, |
| 1237 | 0, 124, 210, 133, 210, 0, 125, 210, 133, 210, |
| 1238 | 133, 210, 0, 126, 210, 133, 210, 133, 210, 0, |
| 1239 | 118, 217, 0, 220, 164, 178, 209, 136, 218, 137, |
| 1240 | 168, 0, 223, 0, 30, 0, 0, 100, 176, 170, |
| 1241 | 0, 100, 176, 133, 9, 209, 170, 0, 101, 176, |
| 1242 | 170, 0, 101, 176, 133, 9, 209, 170, 0, 102, |
| 1243 | 210, 0, 222, 103, 176, 209, 0, 222, 104, 210, |
| 1244 | 133, 176, 209, 0, 105, 176, 209, 219, 0 |
| 1245 | }; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1246 | |
| 1247 | #endif |
| 1248 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1249 | #if YYDEBUG != 0 |
| 1250 | static const short yyrline[] = { 0, |
| 1251 | 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1033, |
| 1252 | 1033, 1033, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1035, |
| 1253 | 1035, 1035, 1035, 1035, 1036, 1036, 1036, 1038, 1038, 1039, |
| 1254 | 1039, 1040, 1040, 1041, 1041, 1042, 1042, 1046, 1046, 1047, |
| 1255 | 1047, 1048, 1048, 1049, 1049, 1050, 1050, 1051, 1051, 1052, |
| 1256 | 1052, 1053, 1054, 1059, 1060, 1060, 1062, 1062, 1063, 1063, |
| 1257 | 1067, 1071, 1076, 1076, 1078, 1082, 1088, 1089, 1090, 1091, |
| 1258 | 1092, 1096, 1097, 1098, 1102, 1103, 1107, 1108, 1109, 1113, |
| 1259 | 1114, 1115, 1116, 1117, 1120, 1120, 1121, 1122, 1123, 1124, |
| 1260 | 1125, 1133, 1134, 1135, 1136, 1139, 1140, 1145, 1146, 1149, |
| 1261 | 1150, 1157, 1157, 1164, 1164, 1173, 1181, 1181, 1187, 1187, |
| 1262 | 1189, 1194, 1207, 1207, 1207, 1207, 1210, 1214, 1218, 1225, |
| 1263 | 1230, 1238, 1256, 1274, 1279, 1291, 1301, 1305, 1315, 1322, |
| 1264 | 1329, 1336, 1341, 1346, 1353, 1354, 1361, 1368, 1376, 1381, |
| 1265 | 1392, 1420, 1436, 1465, 1493, 1518, 1537, 1562, 1581, 1593, |
| 1266 | 1600, 1666, 1676, 1686, 1692, 1698, 1703, 1708, 1716, 1728, |
| 1267 | 1749, 1757, 1763, 1774, 1779, 1784, 1793, 1799, 1805, 1814, |
| 1268 | 1818, 1826, 1826, 1837, 1842, 1850, 1851, 1855, 1855, 1859, |
| 1269 | 1859, 1862, 1865, 1877, 1901, 1912, 1919, 1922, 1927, 1930, |
| 1270 | 1936, 1940, 1943, 1949, 1962, 1966, 1971, 1973, 1978, 1983, |
| 1271 | 1992, 2002, 2013, 2017, 2026, 2035, 2040, 2146, 2146, 2148, |
| 1272 | 2157, 2157, 2159, 2164, 2176, 2180, 2185, 2189, 2193, 2197, |
| 1273 | 2201, 2205, 2209, 2213, 2217, 2242, 2246, 2260, 2264, 2268, |
| 1274 | 2272, 2278, 2278, 2284, 2293, 2297, 2306, 2317, 2326, 2338, |
| 1275 | 2351, 2355, 2359, 2364, 2374, 2393, 2402, 2469, 2473, 2480, |
| 1276 | 2491, 2504, 2513, 2524, 2534, 2542, 2550, 2553, 2554, 2561, |
| 1277 | 2565, 2570, 2591, 2608, 2621, 2634, 2643, 2655, 2663, 2670, |
| 1278 | 2676, 2682, 2688, 2703, 2767, 2772, 2776, 2783, 2790, 2798, |
| 1279 | 2805, 2813, 2821, 2835, 2852 |
| 1280 | }; |
| 1281 | #endif |
| 1282 | |
| 1283 | |
| 1284 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) |
| 1285 | |
| 1286 | static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", |
| 1287 | "EUINT64VAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL","VOID","INTTYPE","FLOAT","DOUBLE", |
| 1288 | "LABEL","TYPE","LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT", |
| 1289 | "IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK", |
| 1290 | "DECLARE","DEFINE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO","DOTDOTDOT", |
| 1291 | "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT", |
| 1292 | "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL", |
| 1293 | "TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK", |
| 1294 | "X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE", |
| 1295 | "UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM", |
| 1296 | "FREM","AND","OR","XOR","ICMP","FCMP","EQ","NE","SLT","SGT","SLE","SGE","ULT", |
| 1297 | "UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD","UNO","UEQ","UNE", |
| 1298 | "MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC","ZEXT","SEXT", |
| 1299 | "FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI","INTTOPTR","PTRTOINT", |
| 1300 | "PHI_TOK","SELECT","SHL","LSHR","ASHR","VAARG","EXTRACTELEMENT","INSERTELEMENT", |
| 1301 | "SHUFFLEVECTOR","NORETURN","INREG","SRET","DEFAULT","HIDDEN","'='","','","'*'", |
| 1302 | "'\\\\'","'('","')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps", |
| 1303 | "LogicalOps","CastOps","ShiftOps","IPredicates","FPredicates","IntType","FPType", |
| 1304 | "LocalName","OptLocalName","OptLocalAssign","GlobalName","OptGlobalAssign","GVInternalLinkage", |
| 1305 | "GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage", |
| 1306 | "OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs","OptAlign", |
| 1307 | "OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute", |
| 1308 | "PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI", |
| 1309 | "ConstVal","ConstExpr","ConstVector","GlobalType","Module","DefinitionList", |
| 1310 | "Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition","LibrariesDefinition", |
| 1311 | "LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END", |
| 1312 | "Function","FunctionProto","OptSideEffect","ConstValueRef","SymbolicValueRef", |
| 1313 | "ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst", |
| 1314 | "JumpTable","Inst","PHIList","ValueRefList","IndexList","OptTailCall","InstVal", |
| 1315 | "OptVolatile","MemoryInst", NULL |
| 1316 | }; |
| 1317 | #endif |
| 1318 | |
| 1319 | static const short yyr1[] = { 0, |
| 1320 | 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, |
| 1321 | 147, 147, 148, 148, 148, 148, 148, 148, 148, 148, |
| 1322 | 148, 148, 148, 148, 149, 149, 149, 150, 150, 150, |
| 1323 | 150, 150, 150, 150, 150, 150, 150, 151, 151, 151, |
| 1324 | 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, |
| 1325 | 151, 151, 151, 152, 153, 153, 154, 154, 155, 155, |
| 1326 | 156, 156, 157, 157, 158, 158, 159, 159, 159, 159, |
| 1327 | 159, 160, 160, 160, 161, 161, 162, 162, 162, 163, |
| 1328 | 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, |
| 1329 | 164, 165, 165, 165, 165, 166, 166, 167, 167, 168, |
| 1330 | 168, 169, 169, 170, 170, 171, 172, 172, 173, 173, |
| 1331 | 174, 174, 175, 175, 175, 175, 176, 176, 176, 176, |
| 1332 | 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, |
| 1333 | 178, 178, 179, 179, 180, 180, 180, 180, 181, 181, |
| 1334 | 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, |
| 1335 | 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, |
| 1336 | 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, |
| 1337 | 184, 185, 185, 186, 186, 187, 187, 189, 188, 190, |
| 1338 | 188, 188, 188, 188, 188, 191, 188, 192, 188, 193, |
| 1339 | 188, 188, 188, 194, 195, 195, 196, 197, 197, 197, |
| 1340 | 198, 198, 199, 199, 199, 199, 200, 201, 201, 202, |
| 1341 | 203, 203, 204, 205, 206, 206, 207, 207, 207, 207, |
| 1342 | 207, 207, 207, 207, 207, 207, 207, 208, 208, 208, |
| 1343 | 208, 209, 209, 210, 211, 211, 212, 213, 213, 213, |
| 1344 | 214, 214, 214, 214, 214, 214, 214, 214, 214, 215, |
| 1345 | 215, 216, 217, 217, 218, 218, 218, 219, 219, 220, |
| 1346 | 220, 221, 221, 221, 221, 221, 221, 221, 221, 221, |
| 1347 | 221, 221, 221, 221, 221, 222, 222, 223, 223, 223, |
| 1348 | 223, 223, 223, 223, 223 |
| 1349 | }; |
| 1350 | |
| 1351 | static const short yyr2[] = { 0, |
| 1352 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1353 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1354 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1355 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1356 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1357 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, |
| 1358 | 2, 0, 1, 1, 2, 0, 1, 1, 1, 1, |
| 1359 | 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, |
| 1360 | 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, |
| 1361 | 2, 1, 1, 1, 1, 0, 2, 1, 1, 0, |
| 1362 | 2, 0, 2, 0, 3, 2, 0, 1, 0, 3, |
| 1363 | 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, |
| 1364 | 2, 5, 5, 5, 5, 3, 2, 5, 4, 2, |
| 1365 | 1, 1, 1, 3, 1, 3, 1, 0, 1, 3, |
| 1366 | 4, 3, 3, 4, 4, 3, 6, 5, 2, 2, |
| 1367 | 2, 2, 2, 2, 2, 2, 2, 2, 6, 5, |
| 1368 | 8, 6, 6, 7, 7, 6, 6, 8, 8, 3, |
| 1369 | 1, 1, 1, 1, 0, 1, 2, 0, 3, 0, |
| 1370 | 3, 3, 1, 3, 3, 0, 6, 0, 7, 0, |
| 1371 | 7, 2, 3, 1, 3, 3, 3, 3, 1, 0, |
| 1372 | 5, 3, 1, 3, 1, 0, 9, 1, 1, 4, |
| 1373 | 1, 1, 2, 3, 0, 1, 1, 1, 1, 1, |
| 1374 | 1, 1, 1, 1, 3, 1, 5, 1, 1, 1, |
| 1375 | 1, 1, 1, 2, 2, 2, 3, 2, 0, 1, |
| 1376 | 2, 2, 3, 9, 9, 8, 14, 1, 1, 6, |
| 1377 | 5, 2, 6, 7, 3, 5, 0, 0, 3, 2, |
| 1378 | 1, 5, 5, 6, 6, 4, 4, 6, 4, 4, |
| 1379 | 6, 6, 2, 8, 1, 1, 0, 3, 6, 3, |
| 1380 | 6, 2, 4, 6, 4 |
| 1381 | }; |
| 1382 | |
| 1383 | static const short yydefact[] = { 66, |
| 1384 | 57, 63, 58, 64, 183, 180, 178, 0, 0, 0, |
| 1385 | 0, 0, 0, 75, 66, 176, 77, 80, 0, 0, |
| 1386 | 192, 0, 0, 61, 0, 65, 67, 69, 68, 70, |
| 1387 | 72, 71, 73, 74, 76, 75, 75, 0, 177, 78, |
| 1388 | 79, 75, 181, 81, 82, 83, 84, 75, 239, 179, |
| 1389 | 239, 0, 0, 200, 193, 194, 182, 228, 229, 185, |
| 1390 | 113, 114, 115, 116, 117, 0, 0, 0, 0, 230, |
| 1391 | 231, 118, 184, 120, 0, 0, 172, 173, 0, 85, |
| 1392 | 85, 240, 236, 62, 211, 212, 213, 235, 195, 196, |
| 1393 | 199, 0, 138, 121, 0, 0, 0, 0, 127, 139, |
| 1394 | 0, 119, 138, 0, 0, 113, 114, 115, 0, 0, |
| 1395 | 0, 186, 0, 86, 87, 88, 89, 90, 0, 214, |
| 1396 | 0, 277, 238, 0, 197, 137, 96, 133, 135, 0, |
| 1397 | 0, 0, 0, 0, 0, 126, 0, 188, 190, 156, |
| 1398 | 157, 154, 155, 158, 153, 149, 150, 1, 2, 3, |
| 1399 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, |
| 1400 | 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, |
| 1401 | 21, 22, 23, 24, 0, 25, 26, 27, 0, 0, |
| 1402 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, |
| 1403 | 151, 109, 91, 132, 131, 0, 208, 209, 210, 276, |
| 1404 | 261, 0, 0, 0, 0, 85, 248, 249, 0, 0, |
| 1405 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1406 | 0, 0, 0, 0, 237, 85, 252, 0, 275, 198, |
| 1407 | 130, 0, 100, 0, 0, 129, 0, 140, 100, 109, |
| 1408 | 109, 28, 29, 30, 31, 32, 33, 34, 35, 36, |
| 1409 | 37, 0, 52, 53, 48, 49, 50, 51, 38, 39, |
| 1410 | 40, 41, 42, 43, 44, 45, 46, 47, 0, 0, |
| 1411 | 0, 0, 0, 0, 142, 171, 0, 0, 0, 146, |
| 1412 | 0, 143, 0, 0, 0, 0, 0, 187, 0, 260, |
| 1413 | 242, 0, 241, 0, 0, 54, 0, 0, 0, 0, |
| 1414 | 104, 104, 282, 0, 0, 273, 0, 0, 0, 0, |
| 1415 | 0, 0, 0, 0, 0, 0, 0, 0, 92, 93, |
| 1416 | 94, 95, 97, 136, 134, 123, 124, 125, 128, 122, |
| 1417 | 189, 191, 0, 0, 258, 0, 0, 0, 0, 0, |
| 1418 | 141, 127, 139, 0, 144, 145, 0, 0, 0, 0, |
| 1419 | 0, 0, 111, 109, 206, 217, 218, 219, 224, 220, |
| 1420 | 221, 222, 223, 215, 0, 226, 233, 232, 234, 0, |
| 1421 | 243, 0, 0, 0, 0, 0, 278, 0, 280, 258, |
| 1422 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1423 | 0, 0, 0, 0, 98, 99, 101, 0, 0, 0, |
| 1424 | 0, 0, 0, 0, 170, 148, 0, 0, 0, 0, |
| 1425 | 0, 106, 112, 110, 205, 96, 203, 0, 216, 0, |
| 1426 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 285, |
| 1427 | 0, 0, 0, 269, 270, 0, 0, 0, 0, 267, |
| 1428 | 266, 0, 283, 0, 0, 0, 0, 160, 0, 0, |
| 1429 | 0, 0, 147, 0, 0, 0, 0, 60, 0, 100, |
| 1430 | 0, 225, 0, 0, 257, 0, 0, 104, 105, 104, |
| 1431 | 0, 0, 0, 0, 0, 262, 263, 257, 0, 0, |
| 1432 | 0, 259, 0, 167, 0, 0, 162, 163, 159, 166, |
| 1433 | 59, 202, 204, 96, 107, 0, 0, 0, 0, 0, |
| 1434 | 264, 265, 0, 279, 281, 0, 0, 268, 271, 272, |
| 1435 | 0, 284, 164, 165, 0, 0, 0, 60, 108, 102, |
| 1436 | 227, 0, 0, 96, 0, 100, 253, 0, 100, 161, |
| 1437 | 168, 169, 201, 0, 207, 0, 246, 0, 0, 255, |
| 1438 | 0, 0, 254, 274, 103, 244, 0, 245, 0, 96, |
| 1439 | 0, 0, 0, 256, 0, 0, 0, 0, 251, 0, |
| 1440 | 0, 250, 0, 247, 0, 0, 0 |
| 1441 | }; |
| 1442 | |
| 1443 | static const short yydefgoto[] = { 186, |
| 1444 | 187, 188, 189, 252, 269, 109, 110, 70, 492, 12, |
| 1445 | 71, 14, 36, 37, 38, 42, 48, 119, 323, 231, |
| 1446 | 397, 326, 535, 377, 353, 520, 288, 354, 72, 111, |
| 1447 | 128, 196, 129, 130, 101, 276, 366, 277, 79, 565, |
| 1448 | 15, 16, 18, 17, 192, 240, 241, 57, 21, 55, |
| 1449 | 92, 417, 418, 120, 199, 49, 87, 50, 43, 420, |
| 1450 | 367, 74, 369, 293, 51, 83, 84, 225, 539, 123, |
| 1451 | 306, 500, 400, 226, 227, 228, 229 |
| 1452 | }; |
| 1453 | |
| 1454 | static const short yypact[] = { 356, |
| 1455 | -32768,-32768,-32768,-32768,-32768,-32768,-32768, 4, -115, -2, |
| 1456 | -52, 93, -4, 51, 593,-32768, 195, 140, 41, 99, |
| 1457 | -32768, 87, 141,-32768, 125,-32768,-32768,-32768,-32768,-32768, |
| 1458 | -32768,-32768,-32768,-32768,-32768, 128, 128, 47,-32768,-32768, |
| 1459 | -32768, 128,-32768,-32768,-32768,-32768,-32768, 128, 251,-32768, |
| 1460 | 17, 262, 264, 269,-32768,-32768,-32768,-32768,-32768, 151, |
| 1461 | -32768,-32768,-32768,-32768,-32768, 287, 292, 3, 13,-32768, |
| 1462 | -32768,-32768, 113,-32768, 47, 47,-32768,-32768, 840, 290, |
| 1463 | 290,-32768,-32768, 88,-32768,-32768,-32768,-32768,-32768,-32768, |
| 1464 | -32768, -90, 1094,-32768, 158, 164, 107, 151,-32768, 113, |
| 1465 | -91,-32768, 1094, 840, 1054, 79, 295, 297, 208, 298, |
| 1466 | 616,-32768, 302,-32768,-32768,-32768,-32768,-32768, 1197,-32768, |
| 1467 | -14, 1319,-32768, 291,-32768,-32768, 113,-32768, 179, 176, |
| 1468 | 1054, 1054, 175, -82, 1054,-32768, 200,-32768, 113,-32768, |
| 1469 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
| 1470 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 241, |
| 1471 | 474, 202,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
| 1472 | -32768,-32768,-32768,-32768, 205,-32768,-32768,-32768, 213, 214, |
| 1473 | 215, 802, 1213, 460, 335, 218, 221, 232, 236,-32768, |
| 1474 | -32768, 245,-32768, 151, 113, 163,-32768,-32768,-32768,-32768, |
| 1475 | -32768, 331, 1235, 210, 371, 290,-32768,-32768, 241, 474, |
| 1476 | 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, |
| 1477 | 1054, 1054, 1054, 1054,-32768, 290,-32768, 181,-32768,-32768, |
| 1478 | -61, 1133,-32768, 26, -64,-32768, 242, 113,-32768, 245, |
| 1479 | 245,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
| 1480 | -32768, 247,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
| 1481 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 249, 840, |
| 1482 | 840, 840, 840, 840,-32768,-32768, -30, 517, -10,-32768, |
| 1483 | -40,-32768, 840, 840, 840, 840, 10,-32768, 252,-32768, |
| 1484 | 151, 759,-32768, 884, 884,-32768, 884, 1197, 1054, 1054, |
| 1485 | 19, 144,-32768, 759, 119, 254, 258, 261, 263, 265, |
| 1486 | 266, 759, 759, 364, 268, 1197, 1054, 1054,-32768,-32768, |
| 1487 | -32768,-32768,-32768,-32768,-32768, -31,-32768,-32768,-32768, -31, |
| 1488 | -32768,-32768, 840, 840,-32768, 271, 273, 275, 276, 840, |
| 1489 | -32768, 260, 616, -6,-32768,-32768, 277, 278, 387, 286, |
| 1490 | 404, 420,-32768, 245, 1149,-32768,-32768,-32768,-32768,-32768, |
| 1491 | -32768,-32768,-32768, 374, 840,-32768,-32768,-32768,-32768, 294, |
| 1492 | -32768, 296, 884, 759, 759, 20,-32768, 25,-32768,-32768, |
| 1493 | 884, 299, 1054, 1054, 1054, 1054, 1054, 301, 303, 1054, |
| 1494 | 1054, 884, 759, 305,-32768,-32768,-32768, 306, 307, 32, |
| 1495 | 840, 840, 840, 840,-32768,-32768, 300, 840, 840, 1054, |
| 1496 | 840,-32768,-32768,-32768,-32768, 113, 310, 308,-32768, 411, |
| 1497 | 8, 432, 434, 311, 315, 319, 884, 428, 884, 320, |
| 1498 | 322, 884, 323, 113,-32768, 324, 326, 884, 884, 113, |
| 1499 | -32768, 325,-32768, 1054, 840, 840, 1054,-32768, 327, 336, |
| 1500 | 330, 343,-32768, 342, 346, 136, 347, 154, 1168,-32768, |
| 1501 | 352,-32768, 884, 884, 1054, 884, 884, 354,-32768, 354, |
| 1502 | 884, 355, 1054, 1054, 1054,-32768,-32768, 1054, 759, 353, |
| 1503 | 357,-32768, 840,-32768, 840, 840,-32768,-32768,-32768,-32768, |
| 1504 | -32768,-32768,-32768, 113, 56, 447, 365, 359, 759, 73, |
| 1505 | -32768,-32768, 454,-32768,-32768, 340, 884,-32768,-32768,-32768, |
| 1506 | 100,-32768,-32768,-32768, 366, 367, 368, 154,-32768, 461, |
| 1507 | -32768, 494, 5,-32768, 1054,-32768,-32768, 369,-32768,-32768, |
| 1508 | -32768,-32768,-32768, 504,-32768, 884,-32768, 1008, 7, -61, |
| 1509 | 759, 182,-32768, -31,-32768,-32768, 379,-32768, 1008,-32768, |
| 1510 | 501, 502, 382, -61, 884, 884, 505, 452,-32768, 884, |
| 1511 | 507,-32768, 884,-32768, 520, 521,-32768 |
| 1512 | }; |
| 1513 | |
| 1514 | static const short yypgoto[] = { 402, |
| 1515 | 408, 414, 415, 329, 332, -203,-32768, 0, 15, 455, |
| 1516 | 11,-32768,-32768,-32768, 204,-32768,-32768, -174, -286, -380, |
| 1517 | -32768, -231,-32768, -296, 45,-32768, -228,-32768,-32768, -24, |
| 1518 | 309, -278,-32768, 440, 449, -69, -108, -179, 168,-32768, |
| 1519 | -32768, 529,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
| 1520 | -32768,-32768,-32768, 467,-32768,-32768,-32768,-32768,-32768,-32768, |
| 1521 | -429, -74, 118, -159,-32768, 498,-32768,-32768,-32768,-32768, |
| 1522 | -32768, 74, 171,-32768,-32768,-32768,-32768 |
| 1523 | }; |
| 1524 | |
| 1525 | |
| 1526 | #define YYLAST 1445 |
| 1527 | |
| 1528 | |
| 1529 | static const short yytable[] = { 11, |
| 1530 | 73, 297, 190, 279, 281, 379, 96, 330, 197, 112, |
| 1531 | 13, 331, 332, 296, 11, 296, 22, 58, 59, 373, |
| 1532 | 98, 61, 62, 63, 64, 13, 1, 2, 427, 3, |
| 1533 | 4, 298, 82, 429, 138, 458, 191, 392, 351, 396, |
| 1534 | 85, 135, 124, 396, 100, 319, 320, 23, 19, 125, |
| 1535 | 135, 316, 136, 303, 65, 352, 307, 308, 309, 310, |
| 1536 | 311, 237, 20, 314, 315, 428, 321, 322, 127, 102, |
| 1537 | 428, 103, 100, 77, 78, 319, 320, 328, 127, 24, |
| 1538 | 139, -54, -54, 11, 351, 27, 28, 29, 30, 31, |
| 1539 | 32, 33, 340, 34, 195, 395, 321, 322, 344, 140, |
| 1540 | 141, 1, 340, 346, 3, 25, 234, 235, 547, 341, |
| 1541 | 238, 58, 59, 518, 98, 61, 62, 63, 64, 553, |
| 1542 | 1, 2, 340, 3, 4, 414, 340, 26, 198, 58, |
| 1543 | 59, 345, 60, 61, 62, 63, 64, 407, 1, 2, |
| 1544 | 340, 3, 4, 540, 537, 97, 548, 66, 65, 462, |
| 1545 | 67, 376, 102, 68, 103, 69, 99, 56, 394, 102, |
| 1546 | 86, 103, 319, 320, 447, 327, 65, 1, 448, 554, |
| 1547 | 3, 504, 52, 505, 44, 45, 46, 2, 292, 47, |
| 1548 | 4, 35, 395, 321, 322, 421, 301, 302, 292, 304, |
| 1549 | 305, 292, 292, 292, 292, 292, 312, 313, 292, 292, |
| 1550 | 335, 336, 337, 338, 339, 525, 289, 127, 396, 526, |
| 1551 | 142, 143, 551, 347, 348, 349, 350, 368, 294, 368, |
| 1552 | 368, 295, 368, 433, 54, 435, 436, 437, 495, 368, |
| 1553 | 53, 441, 525, 40, 190, 41, 529, 368, 368, 75, |
| 1554 | 76, 66, 104, 105, 67, 80, 102, 68, 103, 69, |
| 1555 | 133, 81, 102, 343, 103, 396, 381, 396, 35, 66, |
| 1556 | 319, 320, 67, 398, 399, 68, 82, 69, 191, 102, |
| 1557 | 405, 103, 489, 195, 374, 375, 378, 102, 89, 103, |
| 1558 | 90, 321, 322, 317, 318, 91, 93, 482, 319, 320, |
| 1559 | 94, 195, 393, 292, 542, 95, 131, 544, 368, 368, |
| 1560 | 368, -55, 132, -56, 144, 193, 368, 230, 395, 321, |
| 1561 | 322, 232, 233, 508, 509, 510, 236, 368, 368, 538, |
| 1562 | 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, |
| 1563 | 416, 449, 450, 451, 452, 549, 239, 270, 454, 455, |
| 1564 | 271, 457, 113, 114, 115, 116, 117, 118, 272, 273, |
| 1565 | 274, 282, 368, 283, 368, -175, 284, 368, 292, 434, |
| 1566 | 292, 292, 292, 368, 368, 440, 292, 285, -62, 1, |
| 1567 | 2, 286, 3, 4, 5, 480, 481, 287, 290, 296, |
| 1568 | 6, 7, 333, 329, 334, 456, 382, 355, 368, 368, |
| 1569 | 383, 368, 368, 384, 390, 385, 368, 386, 387, 8, |
| 1570 | 391, 406, 9, 401, 368, 402, 10, 403, 404, 408, |
| 1571 | 409, 370, 371, 515, 372, 516, 517, 410, 411, 479, |
| 1572 | 412, 380, 292, 413, 368, 419, 422, 461, 423, 388, |
| 1573 | 389, 469, 368, 438, 494, 439, 432, 444, 445, 446, |
| 1574 | 499, 453, 459, 463, 460, 464, 465, 466, 292, 292, |
| 1575 | 292, 467, 447, 499, 471, 473, 474, 491, 475, 483, |
| 1576 | 478, 368, 485, 521, 58, 59, 368, 98, 106, 107, |
| 1577 | 108, 64, 484, 1, 2, 486, 3, 4, 487, 527, |
| 1578 | 368, 368, 488, 490, 496, 368, 503, 507, 368, 513, |
| 1579 | 424, 425, 426, 514, 253, 254, 523, 522, 431, 428, |
| 1580 | 541, 65, 530, 531, 532, 536, 534, 545, 543, 442, |
| 1581 | 443, 552, 555, 556, 557, 561, 560, 491, 563, 566, |
| 1582 | 567, 58, 59, 221, 98, 106, 107, 108, 64, 222, |
| 1583 | 1, 2, 533, 3, 4, 223, 224, 299, 122, 519, |
| 1584 | 325, 300, 137, 39, 468, 134, 470, 121, 88, 472, |
| 1585 | 430, 511, 0, 0, 0, 476, 477, 0, 65, 255, |
| 1586 | 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, |
| 1587 | 266, 267, 268, 0, 0, 0, 0, 0, 0, 0, |
| 1588 | 497, 498, 0, 501, 502, 0, 0, 0, 506, 0, |
| 1589 | 0, 0, -174, 0, 66, 0, 512, 67, 0, 0, |
| 1590 | 68, 0, 69, 280, 0, -62, 1, 2, 0, 3, |
| 1591 | 4, 5, 0, 0, 0, 0, 524, 6, 7, 0, |
| 1592 | 58, 59, 0, 0, 528, 0, 0, 0, 0, 1, |
| 1593 | 2, 0, 3, 4, 0, 145, 8, 0, 0, 9, |
| 1594 | 0, 0, 0, 10, 0, 0, 0, 0, 146, 147, |
| 1595 | 0, 66, 0, 546, 67, 0, 0, 68, 550, 69, |
| 1596 | 342, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1597 | 0, 0, 558, 559, 0, 0, 0, 562, 0, 0, |
| 1598 | 564, 148, 149, 150, 151, 152, 153, 154, 155, 156, |
| 1599 | 157, 158, 159, 160, 161, 0, 0, 0, 0, 0, |
| 1600 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1601 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1602 | 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, |
| 1603 | 172, 173, 174, 0, 175, 176, 177, 178, 0, 179, |
| 1604 | 180, 181, 0, 0, 0, 0, 0, 0, 0, 102, |
| 1605 | 0, 103, 0, 182, 0, 0, 183, 0, 184, 0, |
| 1606 | 185, 356, 357, 58, 59, 358, 0, 0, 0, 0, |
| 1607 | 0, 0, 1, 2, 0, 3, 4, 0, 359, 360, |
| 1608 | 361, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1609 | 0, 362, 363, 0, 0, 0, 0, 0, 0, 0, |
| 1610 | 0, 0, 0, 0, 0, 0, 58, 59, 364, 98, |
| 1611 | 106, 107, 108, 64, 0, 1, 2, 0, 3, 4, |
| 1612 | 0, 0, 0, 0, 148, 149, 150, 151, 152, 153, |
| 1613 | 154, 155, 156, 157, 158, 159, 160, 161, 0, 0, |
| 1614 | 0, 0, 0, 65, 58, 59, 0, 98, 106, 107, |
| 1615 | 108, 64, 0, 1, 2, 0, 3, 4, 0, 0, |
| 1616 | 0, 0, 0, 162, 163, 164, 165, 166, 167, 168, |
| 1617 | 169, 170, 171, 172, 173, 174, 0, 175, 176, 177, |
| 1618 | 178, 65, 179, 180, 181, 0, 356, 357, 58, 59, |
| 1619 | 358, 0, 102, 0, 103, 0, 0, 1, 2, 365, |
| 1620 | 3, 4, 0, 359, 360, 361, 0, 0, 0, 0, |
| 1621 | 0, 0, 0, 0, 0, 0, 362, 363, 0, 0, |
| 1622 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1623 | 0, 0, 0, 364, 0, 0, 66, 0, 0, 67, |
| 1624 | 0, 275, 68, 0, 69, 0, 0, 0, 0, 148, |
| 1625 | 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, |
| 1626 | 159, 160, 161, 0, 0, 0, 0, 0, 0, 0, |
| 1627 | 0, 0, 0, 0, 66, 0, 0, 67, 0, 0, |
| 1628 | 68, 0, 69, 0, 0, 0, 0, 0, 162, 163, |
| 1629 | 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, |
| 1630 | 174, 0, 175, 176, 177, 178, 0, 179, 180, 181, |
| 1631 | 356, 357, 0, 0, 358, 0, 0, 0, 0, 0, |
| 1632 | 0, 0, 0, 0, 365, 0, 0, 359, 360, 361, |
| 1633 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1634 | 362, 363, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1635 | 0, 0, 0, 0, 0, 0, 0, 364, 58, 59, |
| 1636 | 0, 98, 61, 62, 63, 64, 0, 1, 2, 0, |
| 1637 | 3, 4, 0, 148, 149, 150, 151, 152, 153, 154, |
| 1638 | 155, 156, 157, 158, 159, 160, 161, 0, 0, 0, |
| 1639 | 0, 0, 0, 0, 0, 65, 0, 0, 58, 59, |
| 1640 | 0, 98, 61, 62, 63, 64, 0, 1, 2, 0, |
| 1641 | 3, 4, 162, 163, 164, 165, 166, 167, 168, 169, |
| 1642 | 170, 171, 172, 173, 174, 126, 175, 176, 177, 178, |
| 1643 | 0, 179, 180, 181, 0, 65, 0, 58, 59, 0, |
| 1644 | 98, 61, 62, 63, 64, 0, 1, 2, 365, 3, |
| 1645 | 4, 0, 0, 58, 59, 0, 98, 61, 62, 63, |
| 1646 | 64, 0, 1, 2, 324, 3, 4, 0, 0, 0, |
| 1647 | 0, 0, 58, 59, 65, 98, 61, 62, 63, 64, |
| 1648 | 415, 1, 2, 0, 3, 4, 0, 0, 66, 0, |
| 1649 | 65, 67, 0, 0, 68, 0, 69, 0, 0, 493, |
| 1650 | 0, 58, 59, 0, 194, 61, 62, 63, 64, 65, |
| 1651 | 1, 2, 0, 3, 4, 0, 0, 58, 59, 0, |
| 1652 | 98, 106, 107, 108, 64, 0, 1, 2, 66, 3, |
| 1653 | 4, 67, 0, 0, 68, 0, 69, 0, 65, 58, |
| 1654 | 59, 0, 291, 61, 62, 63, 64, 0, 1, 2, |
| 1655 | 0, 3, 4, 0, 65, 0, 0, 0, 0, 0, |
| 1656 | 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, |
| 1657 | 67, 0, 0, 68, 0, 69, 65, 0, 0, 0, |
| 1658 | 0, 0, 0, 66, 0, 0, 67, 0, 0, 68, |
| 1659 | 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1660 | 0, 0, 66, 0, 0, 67, 0, 0, 68, 0, |
| 1661 | 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1662 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1663 | 0, 66, 0, 0, 67, 0, 0, 68, 0, 69, |
| 1664 | 0, 0, 0, 0, 0, 0, 0, 66, 200, 0, |
| 1665 | 67, 0, 0, 68, 0, 278, 0, 0, 0, 0, |
| 1666 | 0, 0, 0, 0, 0, 0, 201, 202, 0, 66, |
| 1667 | 0, 0, 67, 0, 0, 68, 0, 69, 203, 204, |
| 1668 | 205, 206, 207, 208, 148, 149, 150, 151, 152, 153, |
| 1669 | 154, 155, 156, 157, 158, 159, 209, 210, 0, 0, |
| 1670 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1671 | 0, 0, 0, 0, 0, 0, 0, 0, 211, 212, |
| 1672 | 213, 0, 0, 214, 163, 164, 165, 166, 167, 168, |
| 1673 | 169, 170, 171, 172, 173, 174, 215, 216, 176, 177, |
| 1674 | 178, 217, 218, 219, 220 |
| 1675 | }; |
| 1676 | |
| 1677 | static const short yycheck[] = { 0, |
| 1678 | 25, 205, 111, 183, 184, 302, 4, 239, 23, 79, |
| 1679 | 0, 240, 241, 9, 15, 9, 132, 5, 6, 298, |
| 1680 | 8, 9, 10, 11, 12, 15, 14, 15, 9, 17, |
| 1681 | 18, 206, 16, 9, 104, 416, 111, 316, 29, 326, |
| 1682 | 24, 133, 133, 330, 69, 107, 108, 50, 45, 140, |
| 1683 | 133, 226, 144, 213, 42, 46, 216, 217, 218, 219, |
| 1684 | 220, 144, 59, 223, 224, 46, 128, 129, 93, 134, |
| 1685 | 46, 136, 97, 27, 28, 107, 108, 142, 103, 132, |
| 1686 | 105, 3, 4, 84, 29, 35, 36, 37, 38, 39, |
| 1687 | 40, 41, 133, 43, 119, 127, 128, 129, 278, 21, |
| 1688 | 22, 14, 133, 144, 17, 13, 131, 132, 538, 140, |
| 1689 | 135, 5, 6, 494, 8, 9, 10, 11, 12, 549, |
| 1690 | 14, 15, 133, 17, 18, 354, 133, 132, 143, 5, |
| 1691 | 6, 142, 8, 9, 10, 11, 12, 144, 14, 15, |
| 1692 | 133, 17, 18, 524, 140, 143, 140, 135, 42, 142, |
| 1693 | 138, 133, 134, 141, 136, 143, 144, 17, 318, 134, |
| 1694 | 144, 136, 107, 108, 133, 140, 42, 14, 137, 550, |
| 1695 | 17, 468, 132, 470, 35, 36, 37, 15, 203, 40, |
| 1696 | 18, 131, 127, 128, 129, 365, 211, 212, 213, 214, |
| 1697 | 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
| 1698 | 270, 271, 272, 273, 274, 133, 196, 232, 495, 137, |
| 1699 | 3, 4, 31, 283, 284, 285, 286, 292, 9, 294, |
| 1700 | 295, 12, 297, 383, 138, 385, 386, 387, 460, 304, |
| 1701 | 132, 391, 133, 39, 343, 41, 137, 312, 313, 36, |
| 1702 | 37, 135, 75, 76, 138, 42, 134, 141, 136, 143, |
| 1703 | 144, 48, 134, 278, 136, 542, 138, 544, 131, 135, |
| 1704 | 107, 108, 138, 333, 334, 141, 16, 143, 343, 134, |
| 1705 | 340, 136, 137, 298, 299, 300, 133, 134, 17, 136, |
| 1706 | 17, 128, 129, 103, 104, 17, 136, 447, 107, 108, |
| 1707 | 4, 316, 317, 318, 526, 4, 139, 529, 373, 374, |
| 1708 | 375, 7, 139, 7, 7, 4, 381, 17, 127, 128, |
| 1709 | 129, 133, 137, 473, 474, 475, 142, 392, 393, 523, |
| 1710 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 1711 | 355, 401, 402, 403, 404, 539, 137, 136, 408, 409, |
| 1712 | 136, 411, 53, 54, 55, 56, 57, 58, 136, 136, |
| 1713 | 136, 17, 427, 136, 429, 0, 136, 432, 383, 384, |
| 1714 | 385, 386, 387, 438, 439, 390, 391, 136, 13, 14, |
| 1715 | 15, 136, 17, 18, 19, 445, 446, 133, 48, 9, |
| 1716 | 25, 26, 136, 142, 136, 410, 133, 136, 463, 464, |
| 1717 | 133, 466, 467, 133, 31, 133, 471, 133, 133, 44, |
| 1718 | 133, 142, 47, 133, 479, 133, 51, 133, 133, 133, |
| 1719 | 133, 294, 295, 483, 297, 485, 486, 31, 133, 444, |
| 1720 | 17, 304, 447, 4, 499, 52, 133, 17, 133, 312, |
| 1721 | 313, 4, 507, 133, 459, 133, 138, 133, 133, 133, |
| 1722 | 465, 142, 133, 12, 137, 12, 136, 133, 473, 474, |
| 1723 | 475, 133, 133, 478, 133, 133, 133, 458, 133, 133, |
| 1724 | 136, 536, 133, 17, 5, 6, 541, 8, 9, 10, |
| 1725 | 11, 12, 137, 14, 15, 133, 17, 18, 137, 140, |
| 1726 | 555, 556, 137, 137, 133, 560, 133, 133, 563, 137, |
| 1727 | 373, 374, 375, 137, 21, 22, 138, 133, 381, 46, |
| 1728 | 525, 42, 137, 137, 137, 12, 46, 4, 140, 392, |
| 1729 | 393, 133, 12, 12, 133, 64, 12, 518, 12, 0, |
| 1730 | 0, 5, 6, 122, 8, 9, 10, 11, 12, 122, |
| 1731 | 14, 15, 518, 17, 18, 122, 122, 209, 84, 495, |
| 1732 | 232, 210, 103, 15, 427, 97, 429, 81, 51, 432, |
| 1733 | 380, 478, -1, -1, -1, 438, 439, -1, 42, 86, |
| 1734 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 1735 | 97, 98, 99, -1, -1, -1, -1, -1, -1, -1, |
| 1736 | 463, 464, -1, 466, 467, -1, -1, -1, 471, -1, |
| 1737 | -1, -1, 0, -1, 135, -1, 479, 138, -1, -1, |
| 1738 | 141, -1, 143, 144, -1, 13, 14, 15, -1, 17, |
| 1739 | 18, 19, -1, -1, -1, -1, 499, 25, 26, -1, |
| 1740 | 5, 6, -1, -1, 507, -1, -1, -1, -1, 14, |
| 1741 | 15, -1, 17, 18, -1, 20, 44, -1, -1, 47, |
| 1742 | -1, -1, -1, 51, -1, -1, -1, -1, 33, 34, |
| 1743 | -1, 135, -1, 536, 138, -1, -1, 141, 541, 143, |
| 1744 | 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1745 | -1, -1, 555, 556, -1, -1, -1, 560, -1, -1, |
| 1746 | 563, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1747 | 75, 76, 77, 78, 79, -1, -1, -1, -1, -1, |
| 1748 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1749 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1750 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1751 | 115, 116, 117, -1, 119, 120, 121, 122, -1, 124, |
| 1752 | 125, 126, -1, -1, -1, -1, -1, -1, -1, 134, |
| 1753 | -1, 136, -1, 138, -1, -1, 141, -1, 143, -1, |
| 1754 | 145, 3, 4, 5, 6, 7, -1, -1, -1, -1, |
| 1755 | -1, -1, 14, 15, -1, 17, 18, -1, 20, 21, |
| 1756 | 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1757 | -1, 33, 34, -1, -1, -1, -1, -1, -1, -1, |
| 1758 | -1, -1, -1, -1, -1, -1, 5, 6, 50, 8, |
| 1759 | 9, 10, 11, 12, -1, 14, 15, -1, 17, 18, |
| 1760 | -1, -1, -1, -1, 66, 67, 68, 69, 70, 71, |
| 1761 | 72, 73, 74, 75, 76, 77, 78, 79, -1, -1, |
| 1762 | -1, -1, -1, 42, 5, 6, -1, 8, 9, 10, |
| 1763 | 11, 12, -1, 14, 15, -1, 17, 18, -1, -1, |
| 1764 | -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, |
| 1765 | 112, 113, 114, 115, 116, 117, -1, 119, 120, 121, |
| 1766 | 122, 42, 124, 125, 126, -1, 3, 4, 5, 6, |
| 1767 | 7, -1, 134, -1, 136, -1, -1, 14, 15, 141, |
| 1768 | 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, |
| 1769 | -1, -1, -1, -1, -1, -1, 33, 34, -1, -1, |
| 1770 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1771 | -1, -1, -1, 50, -1, -1, 135, -1, -1, 138, |
| 1772 | -1, 140, 141, -1, 143, -1, -1, -1, -1, 66, |
| 1773 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 1774 | 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, |
| 1775 | -1, -1, -1, -1, 135, -1, -1, 138, -1, -1, |
| 1776 | 141, -1, 143, -1, -1, -1, -1, -1, 105, 106, |
| 1777 | 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, |
| 1778 | 117, -1, 119, 120, 121, 122, -1, 124, 125, 126, |
| 1779 | 3, 4, -1, -1, 7, -1, -1, -1, -1, -1, |
| 1780 | -1, -1, -1, -1, 141, -1, -1, 20, 21, 22, |
| 1781 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1782 | 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1783 | -1, -1, -1, -1, -1, -1, -1, 50, 5, 6, |
| 1784 | -1, 8, 9, 10, 11, 12, -1, 14, 15, -1, |
| 1785 | 17, 18, -1, 66, 67, 68, 69, 70, 71, 72, |
| 1786 | 73, 74, 75, 76, 77, 78, 79, -1, -1, -1, |
| 1787 | -1, -1, -1, -1, -1, 42, -1, -1, 5, 6, |
| 1788 | -1, 8, 9, 10, 11, 12, -1, 14, 15, -1, |
| 1789 | 17, 18, 105, 106, 107, 108, 109, 110, 111, 112, |
| 1790 | 113, 114, 115, 116, 117, 32, 119, 120, 121, 122, |
| 1791 | -1, 124, 125, 126, -1, 42, -1, 5, 6, -1, |
| 1792 | 8, 9, 10, 11, 12, -1, 14, 15, 141, 17, |
| 1793 | 18, -1, -1, 5, 6, -1, 8, 9, 10, 11, |
| 1794 | 12, -1, 14, 15, 32, 17, 18, -1, -1, -1, |
| 1795 | -1, -1, 5, 6, 42, 8, 9, 10, 11, 12, |
| 1796 | 32, 14, 15, -1, 17, 18, -1, -1, 135, -1, |
| 1797 | 42, 138, -1, -1, 141, -1, 143, -1, -1, 32, |
| 1798 | -1, 5, 6, -1, 8, 9, 10, 11, 12, 42, |
| 1799 | 14, 15, -1, 17, 18, -1, -1, 5, 6, -1, |
| 1800 | 8, 9, 10, 11, 12, -1, 14, 15, 135, 17, |
| 1801 | 18, 138, -1, -1, 141, -1, 143, -1, 42, 5, |
| 1802 | 6, -1, 8, 9, 10, 11, 12, -1, 14, 15, |
| 1803 | -1, 17, 18, -1, 42, -1, -1, -1, -1, -1, |
| 1804 | -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, |
| 1805 | 138, -1, -1, 141, -1, 143, 42, -1, -1, -1, |
| 1806 | -1, -1, -1, 135, -1, -1, 138, -1, -1, 141, |
| 1807 | -1, 143, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1808 | -1, -1, 135, -1, -1, 138, -1, -1, 141, -1, |
| 1809 | 143, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1810 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1811 | -1, 135, -1, -1, 138, -1, -1, 141, -1, 143, |
| 1812 | -1, -1, -1, -1, -1, -1, -1, 135, 30, -1, |
| 1813 | 138, -1, -1, 141, -1, 143, -1, -1, -1, -1, |
| 1814 | -1, -1, -1, -1, -1, -1, 48, 49, -1, 135, |
| 1815 | -1, -1, 138, -1, -1, 141, -1, 143, 60, 61, |
| 1816 | 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, |
| 1817 | 72, 73, 74, 75, 76, 77, 78, 79, -1, -1, |
| 1818 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1819 | -1, -1, -1, -1, -1, -1, -1, -1, 100, 101, |
| 1820 | 102, -1, -1, 105, 106, 107, 108, 109, 110, 111, |
| 1821 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
| 1822 | 122, 123, 124, 125, 126 |
| 1823 | }; |
| 1824 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
| 1825 | #line 3 "/usr/share/bison.simple" |
| 1826 | /* This file comes from bison-1.28. */ |
| 1827 | |
| 1828 | /* Skeleton output parser for bison, |
| 1829 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
| 1830 | |
| 1831 | This program is free software; you can redistribute it and/or modify |
| 1832 | it under the terms of the GNU General Public License as published by |
| 1833 | the Free Software Foundation; either version 2, or (at your option) |
| 1834 | any later version. |
| 1835 | |
| 1836 | This program is distributed in the hope that it will be useful, |
| 1837 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1838 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 1839 | GNU General Public License for more details. |
| 1840 | |
| 1841 | You should have received a copy of the GNU General Public License |
| 1842 | along with this program; if not, write to the Free Software |
| 1843 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 1844 | Boston, MA 02111-1307, USA. */ |
| 1845 | |
| 1846 | /* As a special exception, when this file is copied by Bison into a |
| 1847 | Bison output file, you may use that output file without restriction. |
| 1848 | This special exception was added by the Free Software Foundation |
| 1849 | in version 1.24 of Bison. */ |
| 1850 | |
| 1851 | /* This is the parser code that is written into each bison parser |
| 1852 | when the %semantic_parser declaration is not specified in the grammar. |
| 1853 | It was written by Richard Stallman by simplifying the hairy parser |
| 1854 | used when %semantic_parser is specified. */ |
| 1855 | |
| 1856 | #ifndef YYSTACK_USE_ALLOCA |
| 1857 | #ifdef alloca |
| 1858 | #define YYSTACK_USE_ALLOCA |
| 1859 | #else /* alloca not defined */ |
| 1860 | #ifdef __GNUC__ |
| 1861 | #define YYSTACK_USE_ALLOCA |
| 1862 | #define alloca __builtin_alloca |
| 1863 | #else /* not GNU C. */ |
| 1864 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) |
| 1865 | #define YYSTACK_USE_ALLOCA |
| 1866 | #include <alloca.h> |
| 1867 | #else /* not sparc */ |
| 1868 | /* We think this test detects Watcom and Microsoft C. */ |
| 1869 | /* This used to test MSDOS, but that is a bad idea |
| 1870 | since that symbol is in the user namespace. */ |
| 1871 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) |
| 1872 | #if 0 /* No need for malloc.h, which pollutes the namespace; |
| 1873 | instead, just don't use alloca. */ |
| 1874 | #include <malloc.h> |
| 1875 | #endif |
| 1876 | #else /* not MSDOS, or __TURBOC__ */ |
| 1877 | #if defined(_AIX) |
| 1878 | /* I don't know what this was needed for, but it pollutes the namespace. |
| 1879 | So I turned it off. rms, 2 May 1997. */ |
| 1880 | /* #include <malloc.h> */ |
| 1881 | #pragma alloca |
| 1882 | #define YYSTACK_USE_ALLOCA |
| 1883 | #else /* not MSDOS, or __TURBOC__, or _AIX */ |
| 1884 | #if 0 |
| 1885 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, |
| 1886 | and on HPUX 10. Eventually we can turn this on. */ |
| 1887 | #define YYSTACK_USE_ALLOCA |
| 1888 | #define alloca __builtin_alloca |
| 1889 | #endif /* __hpux */ |
| 1890 | #endif |
| 1891 | #endif /* not _AIX */ |
| 1892 | #endif /* not MSDOS, or __TURBOC__ */ |
| 1893 | #endif /* not sparc */ |
| 1894 | #endif /* not GNU C */ |
| 1895 | #endif /* alloca not defined */ |
| 1896 | #endif /* YYSTACK_USE_ALLOCA not defined */ |
| 1897 | |
| 1898 | #ifdef YYSTACK_USE_ALLOCA |
| 1899 | #define YYSTACK_ALLOC alloca |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1900 | #else |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1901 | #define YYSTACK_ALLOC malloc |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1902 | #endif |
| 1903 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1904 | /* Note: there must be only one dollar sign in this file. |
| 1905 | It is replaced by the list of actions, each action |
| 1906 | as one case of the switch. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1907 | |
| 1908 | #define yyerrok (yyerrstatus = 0) |
| 1909 | #define yyclearin (yychar = YYEMPTY) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1910 | #define YYEMPTY -2 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1911 | #define YYEOF 0 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1912 | #define YYACCEPT goto yyacceptlab |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1913 | #define YYABORT goto yyabortlab |
| 1914 | #define YYERROR goto yyerrlab1 |
| 1915 | /* Like YYERROR except do call yyerror. |
| 1916 | This remains here temporarily to ease the |
| 1917 | transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1918 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1919 | #define YYFAIL goto yyerrlab |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1920 | #define YYRECOVERING() (!!yyerrstatus) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1921 | #define YYBACKUP(token, value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1922 | do \ |
| 1923 | if (yychar == YYEMPTY && yylen == 1) \ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1924 | { yychar = (token), yylval = (value); \ |
| 1925 | yychar1 = YYTRANSLATE (yychar); \ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1926 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1927 | goto yybackup; \ |
| 1928 | } \ |
| 1929 | else \ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1930 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 1931 | while (0) |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1932 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1933 | #define YYTERROR 1 |
| 1934 | #define YYERRCODE 256 |
| 1935 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1936 | #ifndef YYPURE |
| 1937 | #define YYLEX yylex() |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1938 | #endif |
| 1939 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1940 | #ifdef YYPURE |
| 1941 | #ifdef YYLSP_NEEDED |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1942 | #ifdef YYLEX_PARAM |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1943 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1944 | #else |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1945 | #define YYLEX yylex(&yylval, &yylloc) |
| 1946 | #endif |
| 1947 | #else /* not YYLSP_NEEDED */ |
| 1948 | #ifdef YYLEX_PARAM |
| 1949 | #define YYLEX yylex(&yylval, YYLEX_PARAM) |
| 1950 | #else |
| 1951 | #define YYLEX yylex(&yylval) |
| 1952 | #endif |
| 1953 | #endif /* not YYLSP_NEEDED */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1954 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1955 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1956 | /* If nonreentrant, generate the variables here */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1957 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1958 | #ifndef YYPURE |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 1959 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1960 | int yychar; /* the lookahead symbol */ |
| 1961 | YYSTYPE yylval; /* the semantic value of the */ |
| 1962 | /* lookahead symbol */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1963 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1964 | #ifdef YYLSP_NEEDED |
| 1965 | YYLTYPE yylloc; /* location data for the lookahead */ |
| 1966 | /* symbol */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1967 | #endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1968 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1969 | int yynerrs; /* number of parse errors so far */ |
| 1970 | #endif /* not YYPURE */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1971 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1972 | #if YYDEBUG != 0 |
| 1973 | int yydebug; /* nonzero means print parse trace */ |
| 1974 | /* Since this is uninitialized, it does not stop multiple parsers |
| 1975 | from coexisting. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1976 | #endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1977 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1978 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1979 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1980 | #ifndef YYINITDEPTH |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1981 | #define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1982 | #endif |
| 1983 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1984 | /* YYMAXDEPTH is the maximum size the stacks can grow to |
| 1985 | (effective only if the built-in stack extension method is used). */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1986 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1987 | #if YYMAXDEPTH == 0 |
| 1988 | #undef YYMAXDEPTH |
| 1989 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1990 | |
| 1991 | #ifndef YYMAXDEPTH |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1992 | #define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1993 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1994 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 1995 | /* Define __yy_memcpy. Note that the size argument |
| 1996 | should be passed with type unsigned int, because that is what the non-GCC |
| 1997 | definitions require. With GCC, __builtin_memcpy takes an arg |
| 1998 | of type size_t, but it can handle unsigned int. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1999 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2000 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
| 2001 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) |
| 2002 | #else /* not GNU C or C++ */ |
| 2003 | #ifndef __cplusplus |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2004 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2005 | /* This is the most reliable way to avoid incompatibilities |
| 2006 | in available built-in functions on various systems. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2007 | static void |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2008 | __yy_memcpy (to, from, count) |
| 2009 | char *to; |
| 2010 | char *from; |
| 2011 | unsigned int count; |
| 2012 | { |
| 2013 | register char *f = from; |
| 2014 | register char *t = to; |
| 2015 | register int i = count; |
| 2016 | |
| 2017 | while (i-- > 0) |
| 2018 | *t++ = *f++; |
| 2019 | } |
| 2020 | |
| 2021 | #else /* __cplusplus */ |
| 2022 | |
| 2023 | /* This is the most reliable way to avoid incompatibilities |
| 2024 | in available built-in functions on various systems. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2025 | static void |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2026 | __yy_memcpy (char *to, char *from, unsigned int count) |
| 2027 | { |
| 2028 | register char *t = to; |
| 2029 | register char *f = from; |
| 2030 | register int i = count; |
| 2031 | |
| 2032 | while (i-- > 0) |
| 2033 | *t++ = *f++; |
| 2034 | } |
| 2035 | |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2036 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2037 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2038 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2039 | #line 217 "/usr/share/bison.simple" |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2040 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2041 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
| 2042 | into yyparse. The argument should have type void *. |
| 2043 | It should actually point to an object. |
| 2044 | Grammar actions can access the variable by casting it |
| 2045 | to the proper pointer type. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2046 | |
| 2047 | #ifdef YYPARSE_PARAM |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2048 | #ifdef __cplusplus |
| 2049 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
| 2050 | #define YYPARSE_PARAM_DECL |
| 2051 | #else /* not __cplusplus */ |
| 2052 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM |
| 2053 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
| 2054 | #endif /* not __cplusplus */ |
| 2055 | #else /* not YYPARSE_PARAM */ |
| 2056 | #define YYPARSE_PARAM_ARG |
| 2057 | #define YYPARSE_PARAM_DECL |
| 2058 | #endif /* not YYPARSE_PARAM */ |
| 2059 | |
| 2060 | /* Prevent warning if -Wstrict-prototypes. */ |
| 2061 | #ifdef __GNUC__ |
| 2062 | #ifdef YYPARSE_PARAM |
| 2063 | int yyparse (void *); |
| 2064 | #else |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2065 | int yyparse (void); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2066 | #endif |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2067 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2068 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2069 | int |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2070 | yyparse(YYPARSE_PARAM_ARG) |
| 2071 | YYPARSE_PARAM_DECL |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2072 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2073 | register int yystate; |
| 2074 | register int yyn; |
| 2075 | register short *yyssp; |
| 2076 | register YYSTYPE *yyvsp; |
| 2077 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ |
| 2078 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2079 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2080 | short yyssa[YYINITDEPTH]; /* the state stack */ |
| 2081 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2082 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2083 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ |
| 2084 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2085 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2086 | #ifdef YYLSP_NEEDED |
| 2087 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ |
| 2088 | YYLTYPE *yyls = yylsa; |
| 2089 | YYLTYPE *yylsp; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2090 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2091 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
| 2092 | #else |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2093 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2094 | #endif |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2095 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2096 | int yystacksize = YYINITDEPTH; |
| 2097 | int yyfree_stacks = 0; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2098 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2099 | #ifdef YYPURE |
| 2100 | int yychar; |
| 2101 | YYSTYPE yylval; |
| 2102 | int yynerrs; |
| 2103 | #ifdef YYLSP_NEEDED |
| 2104 | YYLTYPE yylloc; |
| 2105 | #endif |
| 2106 | #endif |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2107 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2108 | YYSTYPE yyval; /* the variable used to return */ |
| 2109 | /* semantic values from the action */ |
| 2110 | /* routines */ |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2111 | |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2112 | int yylen; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2113 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2114 | #if YYDEBUG != 0 |
| 2115 | if (yydebug) |
| 2116 | fprintf(stderr, "Starting parse\n"); |
| 2117 | #endif |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 2118 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2119 | yystate = 0; |
| 2120 | yyerrstatus = 0; |
| 2121 | yynerrs = 0; |
| 2122 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2123 | |
| 2124 | /* Initialize stack pointers. |
| 2125 | Waste one element of value and location stack |
| 2126 | so that they stay on the same level as the state stack. |
| 2127 | The wasted elements are never initialized. */ |
| 2128 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2129 | yyssp = yyss - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2130 | yyvsp = yyvs; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2131 | #ifdef YYLSP_NEEDED |
| 2132 | yylsp = yyls; |
| 2133 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2134 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2135 | /* Push a new state, which is found in yystate . */ |
| 2136 | /* In all cases, when you get here, the value and location stacks |
| 2137 | have just been pushed. so pushing a state here evens the stacks. */ |
| 2138 | yynewstate: |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2139 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2140 | *++yyssp = yystate; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2141 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2142 | if (yyssp >= yyss + yystacksize - 1) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2143 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2144 | /* Give user a chance to reallocate the stack */ |
| 2145 | /* Use copies of these so that the &'s don't force the real ones into memory. */ |
| 2146 | YYSTYPE *yyvs1 = yyvs; |
| 2147 | short *yyss1 = yyss; |
| 2148 | #ifdef YYLSP_NEEDED |
| 2149 | YYLTYPE *yyls1 = yyls; |
| 2150 | #endif |
| 2151 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2152 | /* Get the current used size of the three stacks, in elements. */ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2153 | int size = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2154 | |
| 2155 | #ifdef yyoverflow |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2156 | /* Each stack pointer address is followed by the size of |
| 2157 | the data in use in that stack, in bytes. */ |
| 2158 | #ifdef YYLSP_NEEDED |
| 2159 | /* This used to be a conditional around just the two extra args, |
| 2160 | but that might be undefined if yyoverflow is a macro. */ |
| 2161 | yyoverflow("parser stack overflow", |
| 2162 | &yyss1, size * sizeof (*yyssp), |
| 2163 | &yyvs1, size * sizeof (*yyvsp), |
| 2164 | &yyls1, size * sizeof (*yylsp), |
| 2165 | &yystacksize); |
| 2166 | #else |
| 2167 | yyoverflow("parser stack overflow", |
| 2168 | &yyss1, size * sizeof (*yyssp), |
| 2169 | &yyvs1, size * sizeof (*yyvsp), |
| 2170 | &yystacksize); |
| 2171 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2172 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2173 | yyss = yyss1; yyvs = yyvs1; |
| 2174 | #ifdef YYLSP_NEEDED |
| 2175 | yyls = yyls1; |
| 2176 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2177 | #else /* no yyoverflow */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2178 | /* Extend the stack our own way. */ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2179 | if (yystacksize >= YYMAXDEPTH) |
| 2180 | { |
| 2181 | yyerror("parser stack overflow"); |
| 2182 | if (yyfree_stacks) |
| 2183 | { |
| 2184 | free (yyss); |
| 2185 | free (yyvs); |
| 2186 | #ifdef YYLSP_NEEDED |
| 2187 | free (yyls); |
| 2188 | #endif |
| 2189 | } |
| 2190 | return 2; |
| 2191 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2192 | yystacksize *= 2; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2193 | if (yystacksize > YYMAXDEPTH) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2194 | yystacksize = YYMAXDEPTH; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2195 | #ifndef YYSTACK_USE_ALLOCA |
| 2196 | yyfree_stacks = 1; |
| 2197 | #endif |
| 2198 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); |
| 2199 | __yy_memcpy ((char *)yyss, (char *)yyss1, |
| 2200 | size * (unsigned int) sizeof (*yyssp)); |
| 2201 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); |
| 2202 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, |
| 2203 | size * (unsigned int) sizeof (*yyvsp)); |
| 2204 | #ifdef YYLSP_NEEDED |
| 2205 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
| 2206 | __yy_memcpy ((char *)yyls, (char *)yyls1, |
| 2207 | size * (unsigned int) sizeof (*yylsp)); |
| 2208 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2209 | #endif /* no yyoverflow */ |
| 2210 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2211 | yyssp = yyss + size - 1; |
| 2212 | yyvsp = yyvs + size - 1; |
| 2213 | #ifdef YYLSP_NEEDED |
| 2214 | yylsp = yyls + size - 1; |
| 2215 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2216 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2217 | #if YYDEBUG != 0 |
| 2218 | if (yydebug) |
| 2219 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); |
| 2220 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2221 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2222 | if (yyssp >= yyss + yystacksize - 1) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2223 | YYABORT; |
| 2224 | } |
| 2225 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2226 | #if YYDEBUG != 0 |
| 2227 | if (yydebug) |
| 2228 | fprintf(stderr, "Entering state %d\n", yystate); |
| 2229 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2230 | |
| 2231 | goto yybackup; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2232 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2233 | |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2234 | /* Do appropriate processing given the current state. */ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2235 | /* Read a lookahead token if we need one and don't already have one. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2236 | /* yyresume: */ |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2237 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2238 | /* First try to decide what to do without reference to lookahead token. */ |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2239 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2240 | yyn = yypact[yystate]; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2241 | if (yyn == YYFLAG) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2242 | goto yydefault; |
| 2243 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2244 | /* Not known => get a lookahead token if don't already have one. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2245 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2246 | /* yychar is either YYEMPTY or YYEOF |
| 2247 | or a valid token in external form. */ |
| 2248 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2249 | if (yychar == YYEMPTY) |
| 2250 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2251 | #if YYDEBUG != 0 |
| 2252 | if (yydebug) |
| 2253 | fprintf(stderr, "Reading a token: "); |
| 2254 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2255 | yychar = YYLEX; |
| 2256 | } |
| 2257 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2258 | /* Convert token to internal form (in yychar1) for indexing tables with */ |
| 2259 | |
| 2260 | if (yychar <= 0) /* This means end of input. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2261 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2262 | yychar1 = 0; |
| 2263 | yychar = YYEOF; /* Don't call YYLEX any more */ |
| 2264 | |
| 2265 | #if YYDEBUG != 0 |
| 2266 | if (yydebug) |
| 2267 | fprintf(stderr, "Now at end of input.\n"); |
| 2268 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2269 | } |
| 2270 | else |
| 2271 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2272 | yychar1 = YYTRANSLATE(yychar); |
| 2273 | |
| 2274 | #if YYDEBUG != 0 |
| 2275 | if (yydebug) |
| 2276 | { |
| 2277 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); |
| 2278 | /* Give the individual parser a way to print the precise meaning |
| 2279 | of a token, for further debugging info. */ |
| 2280 | #ifdef YYPRINT |
| 2281 | YYPRINT (stderr, yychar, yylval); |
| 2282 | #endif |
| 2283 | fprintf (stderr, ")\n"); |
| 2284 | } |
| 2285 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2286 | } |
| 2287 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2288 | yyn += yychar1; |
| 2289 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2290 | goto yydefault; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2291 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2292 | yyn = yytable[yyn]; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2293 | |
| 2294 | /* yyn is what to do for this token type in this state. |
| 2295 | Negative => reduce, -yyn is rule number. |
| 2296 | Positive => shift, yyn is new state. |
| 2297 | New state is final state => don't bother to shift, |
| 2298 | just return success. |
| 2299 | 0, or most negative number => error. */ |
| 2300 | |
| 2301 | if (yyn < 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2302 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2303 | if (yyn == YYFLAG) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2304 | goto yyerrlab; |
| 2305 | yyn = -yyn; |
| 2306 | goto yyreduce; |
| 2307 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2308 | else if (yyn == 0) |
| 2309 | goto yyerrlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2310 | |
| 2311 | if (yyn == YYFINAL) |
| 2312 | YYACCEPT; |
| 2313 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2314 | /* Shift the lookahead token. */ |
| 2315 | |
| 2316 | #if YYDEBUG != 0 |
| 2317 | if (yydebug) |
| 2318 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); |
| 2319 | #endif |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2320 | |
| 2321 | /* Discard the token being shifted unless it is eof. */ |
| 2322 | if (yychar != YYEOF) |
| 2323 | yychar = YYEMPTY; |
| 2324 | |
| 2325 | *++yyvsp = yylval; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2326 | #ifdef YYLSP_NEEDED |
| 2327 | *++yylsp = yylloc; |
| 2328 | #endif |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 2329 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2330 | /* count tokens shifted since error; after three, turn off error status. */ |
| 2331 | if (yyerrstatus) yyerrstatus--; |
Chris Lattner | 0fab59c | 2007-01-12 18:33:30 +0000 | [diff] [blame] | 2332 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2333 | yystate = yyn; |
| 2334 | goto yynewstate; |
| 2335 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2336 | /* Do the default action for the current state. */ |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2337 | yydefault: |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2338 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2339 | yyn = yydefact[yystate]; |
| 2340 | if (yyn == 0) |
| 2341 | goto yyerrlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2342 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2343 | /* Do a reduction. yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2344 | yyreduce: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2345 | yylen = yyr2[yyn]; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2346 | if (yylen > 0) |
| 2347 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2348 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2349 | #if YYDEBUG != 0 |
| 2350 | if (yydebug) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2351 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2352 | int i; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2353 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2354 | fprintf (stderr, "Reducing via rule %d (line %d), ", |
| 2355 | yyn, yyrline[yyn]); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2356 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2357 | /* Print the symbols being reduced, and their result. */ |
| 2358 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) |
| 2359 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); |
| 2360 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
| 2361 | } |
| 2362 | #endif |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2363 | |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2364 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2365 | switch (yyn) { |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 2366 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2367 | case 28: |
| 2368 | #line 1038 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2369 | { yyval.IPredicate = ICmpInst::ICMP_EQ; ; |
| 2370 | break;} |
| 2371 | case 29: |
| 2372 | #line 1038 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2373 | { yyval.IPredicate = ICmpInst::ICMP_NE; ; |
| 2374 | break;} |
| 2375 | case 30: |
| 2376 | #line 1039 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2377 | { yyval.IPredicate = ICmpInst::ICMP_SLT; ; |
| 2378 | break;} |
| 2379 | case 31: |
| 2380 | #line 1039 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2381 | { yyval.IPredicate = ICmpInst::ICMP_SGT; ; |
| 2382 | break;} |
| 2383 | case 32: |
| 2384 | #line 1040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2385 | { yyval.IPredicate = ICmpInst::ICMP_SLE; ; |
| 2386 | break;} |
| 2387 | case 33: |
| 2388 | #line 1040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2389 | { yyval.IPredicate = ICmpInst::ICMP_SGE; ; |
| 2390 | break;} |
| 2391 | case 34: |
| 2392 | #line 1041 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2393 | { yyval.IPredicate = ICmpInst::ICMP_ULT; ; |
| 2394 | break;} |
| 2395 | case 35: |
| 2396 | #line 1041 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2397 | { yyval.IPredicate = ICmpInst::ICMP_UGT; ; |
| 2398 | break;} |
| 2399 | case 36: |
| 2400 | #line 1042 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2401 | { yyval.IPredicate = ICmpInst::ICMP_ULE; ; |
| 2402 | break;} |
| 2403 | case 37: |
| 2404 | #line 1042 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2405 | { yyval.IPredicate = ICmpInst::ICMP_UGE; ; |
| 2406 | break;} |
| 2407 | case 38: |
| 2408 | #line 1046 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2409 | { yyval.FPredicate = FCmpInst::FCMP_OEQ; ; |
| 2410 | break;} |
| 2411 | case 39: |
| 2412 | #line 1046 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2413 | { yyval.FPredicate = FCmpInst::FCMP_ONE; ; |
| 2414 | break;} |
| 2415 | case 40: |
| 2416 | #line 1047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2417 | { yyval.FPredicate = FCmpInst::FCMP_OLT; ; |
| 2418 | break;} |
| 2419 | case 41: |
| 2420 | #line 1047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2421 | { yyval.FPredicate = FCmpInst::FCMP_OGT; ; |
| 2422 | break;} |
| 2423 | case 42: |
| 2424 | #line 1048 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2425 | { yyval.FPredicate = FCmpInst::FCMP_OLE; ; |
| 2426 | break;} |
| 2427 | case 43: |
| 2428 | #line 1048 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2429 | { yyval.FPredicate = FCmpInst::FCMP_OGE; ; |
| 2430 | break;} |
| 2431 | case 44: |
| 2432 | #line 1049 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2433 | { yyval.FPredicate = FCmpInst::FCMP_ORD; ; |
| 2434 | break;} |
| 2435 | case 45: |
| 2436 | #line 1049 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2437 | { yyval.FPredicate = FCmpInst::FCMP_UNO; ; |
| 2438 | break;} |
| 2439 | case 46: |
| 2440 | #line 1050 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2441 | { yyval.FPredicate = FCmpInst::FCMP_UEQ; ; |
| 2442 | break;} |
| 2443 | case 47: |
| 2444 | #line 1050 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2445 | { yyval.FPredicate = FCmpInst::FCMP_UNE; ; |
| 2446 | break;} |
| 2447 | case 48: |
| 2448 | #line 1051 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2449 | { yyval.FPredicate = FCmpInst::FCMP_ULT; ; |
| 2450 | break;} |
| 2451 | case 49: |
| 2452 | #line 1051 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2453 | { yyval.FPredicate = FCmpInst::FCMP_UGT; ; |
| 2454 | break;} |
| 2455 | case 50: |
| 2456 | #line 1052 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2457 | { yyval.FPredicate = FCmpInst::FCMP_ULE; ; |
| 2458 | break;} |
| 2459 | case 51: |
| 2460 | #line 1052 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2461 | { yyval.FPredicate = FCmpInst::FCMP_UGE; ; |
| 2462 | break;} |
| 2463 | case 52: |
| 2464 | #line 1053 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2465 | { yyval.FPredicate = FCmpInst::FCMP_TRUE; ; |
| 2466 | break;} |
| 2467 | case 53: |
| 2468 | #line 1054 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2469 | { yyval.FPredicate = FCmpInst::FCMP_FALSE; ; |
| 2470 | break;} |
| 2471 | case 60: |
| 2472 | #line 1063 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2473 | { yyval.StrVal = 0; ; |
| 2474 | break;} |
| 2475 | case 61: |
| 2476 | #line 1067 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2477 | { |
| 2478 | yyval.StrVal = yyvsp[-1].StrVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2479 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2480 | ; |
| 2481 | break;} |
| 2482 | case 62: |
| 2483 | #line 1071 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2484 | { |
| 2485 | yyval.StrVal = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2486 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2487 | ; |
| 2488 | break;} |
| 2489 | case 65: |
| 2490 | #line 1078 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2491 | { |
| 2492 | yyval.StrVal = yyvsp[-1].StrVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2493 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2494 | ; |
| 2495 | break;} |
| 2496 | case 66: |
| 2497 | #line 1082 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2498 | { |
| 2499 | yyval.StrVal = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2500 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2501 | ; |
| 2502 | break;} |
| 2503 | case 67: |
| 2504 | #line 1088 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2505 | { yyval.Linkage = GlobalValue::InternalLinkage; ; |
| 2506 | break;} |
| 2507 | case 68: |
| 2508 | #line 1089 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2509 | { yyval.Linkage = GlobalValue::WeakLinkage; ; |
| 2510 | break;} |
| 2511 | case 69: |
| 2512 | #line 1090 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2513 | { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; |
| 2514 | break;} |
| 2515 | case 70: |
| 2516 | #line 1091 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2517 | { yyval.Linkage = GlobalValue::AppendingLinkage; ; |
| 2518 | break;} |
| 2519 | case 71: |
| 2520 | #line 1092 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2521 | { yyval.Linkage = GlobalValue::DLLExportLinkage; ; |
| 2522 | break;} |
| 2523 | case 72: |
| 2524 | #line 1096 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2525 | { yyval.Linkage = GlobalValue::DLLImportLinkage; ; |
| 2526 | break;} |
| 2527 | case 73: |
| 2528 | #line 1097 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2529 | { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; |
| 2530 | break;} |
| 2531 | case 74: |
| 2532 | #line 1098 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2533 | { yyval.Linkage = GlobalValue::ExternalLinkage; ; |
| 2534 | break;} |
| 2535 | case 75: |
| 2536 | #line 1102 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2537 | { yyval.Visibility = GlobalValue::DefaultVisibility; ; |
| 2538 | break;} |
| 2539 | case 76: |
| 2540 | #line 1103 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2541 | { yyval.Visibility = GlobalValue::HiddenVisibility; ; |
| 2542 | break;} |
| 2543 | case 77: |
| 2544 | #line 1107 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2545 | { yyval.Linkage = GlobalValue::ExternalLinkage; ; |
| 2546 | break;} |
| 2547 | case 78: |
| 2548 | #line 1108 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2549 | { yyval.Linkage = GlobalValue::DLLImportLinkage; ; |
| 2550 | break;} |
| 2551 | case 79: |
| 2552 | #line 1109 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2553 | { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; |
| 2554 | break;} |
| 2555 | case 80: |
| 2556 | #line 1113 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2557 | { yyval.Linkage = GlobalValue::ExternalLinkage; ; |
| 2558 | break;} |
| 2559 | case 81: |
| 2560 | #line 1114 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2561 | { yyval.Linkage = GlobalValue::InternalLinkage; ; |
| 2562 | break;} |
| 2563 | case 82: |
| 2564 | #line 1115 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2565 | { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; |
| 2566 | break;} |
| 2567 | case 83: |
| 2568 | #line 1116 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2569 | { yyval.Linkage = GlobalValue::WeakLinkage; ; |
| 2570 | break;} |
| 2571 | case 84: |
| 2572 | #line 1117 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2573 | { yyval.Linkage = GlobalValue::DLLExportLinkage; ; |
| 2574 | break;} |
| 2575 | case 85: |
| 2576 | #line 1120 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2577 | { yyval.UIntVal = CallingConv::C; ; |
| 2578 | break;} |
| 2579 | case 86: |
| 2580 | #line 1121 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2581 | { yyval.UIntVal = CallingConv::C; ; |
| 2582 | break;} |
| 2583 | case 87: |
| 2584 | #line 1122 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2585 | { yyval.UIntVal = CallingConv::Fast; ; |
| 2586 | break;} |
| 2587 | case 88: |
| 2588 | #line 1123 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2589 | { yyval.UIntVal = CallingConv::Cold; ; |
| 2590 | break;} |
| 2591 | case 89: |
| 2592 | #line 1124 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2593 | { yyval.UIntVal = CallingConv::X86_StdCall; ; |
| 2594 | break;} |
| 2595 | case 90: |
| 2596 | #line 1125 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2597 | { yyval.UIntVal = CallingConv::X86_FastCall; ; |
| 2598 | break;} |
| 2599 | case 91: |
| 2600 | #line 1126 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2601 | { |
| 2602 | if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2603 | GEN_ERROR("Calling conv too large!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2604 | yyval.UIntVal = yyvsp[0].UInt64Val; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2605 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2606 | ; |
| 2607 | break;} |
| 2608 | case 92: |
| 2609 | #line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2610 | { yyval.ParamAttrs = FunctionType::ZExtAttribute; ; |
| 2611 | break;} |
| 2612 | case 93: |
| 2613 | #line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2614 | { yyval.ParamAttrs = FunctionType::SExtAttribute; ; |
| 2615 | break;} |
| 2616 | case 94: |
| 2617 | #line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2618 | { yyval.ParamAttrs = FunctionType::InRegAttribute; ; |
| 2619 | break;} |
| 2620 | case 95: |
| 2621 | #line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2622 | { yyval.ParamAttrs = FunctionType::StructRetAttribute; ; |
| 2623 | break;} |
| 2624 | case 96: |
| 2625 | #line 1139 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2626 | { yyval.ParamAttrs = FunctionType::NoAttributeSet; ; |
| 2627 | break;} |
| 2628 | case 97: |
| 2629 | #line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2630 | { |
| 2631 | yyval.ParamAttrs = FunctionType::ParameterAttributes(yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs); |
| 2632 | ; |
| 2633 | break;} |
| 2634 | case 98: |
| 2635 | #line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2636 | { yyval.ParamAttrs = FunctionType::NoReturnAttribute; ; |
| 2637 | break;} |
| 2638 | case 100: |
| 2639 | #line 1149 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2640 | { yyval.ParamAttrs = FunctionType::NoAttributeSet; ; |
| 2641 | break;} |
| 2642 | case 101: |
| 2643 | #line 1150 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2644 | { |
| 2645 | yyval.ParamAttrs = FunctionType::ParameterAttributes(yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs); |
| 2646 | ; |
| 2647 | break;} |
| 2648 | case 102: |
| 2649 | #line 1157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2650 | { yyval.UIntVal = 0; ; |
| 2651 | break;} |
| 2652 | case 103: |
| 2653 | #line 1158 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2654 | { |
| 2655 | yyval.UIntVal = yyvsp[0].UInt64Val; |
| 2656 | if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2657 | GEN_ERROR("Alignment must be a power of two!"); |
| 2658 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2659 | ; |
| 2660 | break;} |
| 2661 | case 104: |
| 2662 | #line 1164 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2663 | { yyval.UIntVal = 0; ; |
| 2664 | break;} |
| 2665 | case 105: |
| 2666 | #line 1165 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2667 | { |
| 2668 | yyval.UIntVal = yyvsp[0].UInt64Val; |
| 2669 | if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2670 | GEN_ERROR("Alignment must be a power of two!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2671 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2672 | ; |
| 2673 | break;} |
| 2674 | case 106: |
| 2675 | #line 1173 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2676 | { |
| 2677 | for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) |
| 2678 | if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2679 | GEN_ERROR("Invalid character in section name!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2680 | yyval.StrVal = yyvsp[0].StrVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2681 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2682 | ; |
| 2683 | break;} |
| 2684 | case 107: |
| 2685 | #line 1181 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2686 | { yyval.StrVal = 0; ; |
| 2687 | break;} |
| 2688 | case 108: |
| 2689 | #line 1182 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2690 | { yyval.StrVal = yyvsp[0].StrVal; ; |
| 2691 | break;} |
| 2692 | case 109: |
| 2693 | #line 1187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2694 | {; |
| 2695 | break;} |
| 2696 | case 110: |
| 2697 | #line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2698 | {; |
| 2699 | break;} |
| 2700 | case 111: |
| 2701 | #line 1189 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2702 | { |
| 2703 | CurGV->setSection(yyvsp[0].StrVal); |
| 2704 | free(yyvsp[0].StrVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2705 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2706 | ; |
| 2707 | break;} |
| 2708 | case 112: |
| 2709 | #line 1194 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2710 | { |
| 2711 | if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2712 | GEN_ERROR("Alignment must be a power of two!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2713 | CurGV->setAlignment(yyvsp[0].UInt64Val); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2714 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2715 | ; |
| 2716 | break;} |
| 2717 | case 117: |
| 2718 | #line 1210 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2719 | { |
| 2720 | yyval.TypeVal = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2721 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2722 | ; |
| 2723 | break;} |
| 2724 | case 118: |
| 2725 | #line 1214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2726 | { |
| 2727 | yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2728 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2729 | ; |
| 2730 | break;} |
| 2731 | case 119: |
| 2732 | #line 1218 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2733 | { // Pointer type? |
| 2734 | if (*yyvsp[-1].TypeVal == Type::LabelTy) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2735 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2736 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); |
| 2737 | delete yyvsp[-1].TypeVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2738 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2739 | ; |
| 2740 | break;} |
| 2741 | case 120: |
| 2742 | #line 1225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2743 | { // Named types are also simple types... |
| 2744 | const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2745 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2746 | yyval.TypeVal = new PATypeHolder(tmp); |
| 2747 | ; |
| 2748 | break;} |
| 2749 | case 121: |
| 2750 | #line 1230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2751 | { // Type UpReference |
| 2752 | if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2753 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2754 | UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... |
| 2755 | yyval.TypeVal = new PATypeHolder(OT); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2756 | UR_OUT("New Upreference!\n"); |
| 2757 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2758 | ; |
| 2759 | break;} |
| 2760 | case 122: |
| 2761 | #line 1238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2762 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2763 | std::vector<const Type*> Params; |
| 2764 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2765 | Attrs.push_back(yyvsp[0].ParamAttrs); |
| 2766 | for (TypeWithAttrsList::iterator I=yyvsp[-2].TypeWithAttrsList->begin(), E=yyvsp[-2].TypeWithAttrsList->end(); I != E; ++I) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2767 | Params.push_back(I->Ty->get()); |
| 2768 | if (I->Ty->get() != Type::VoidTy) |
| 2769 | Attrs.push_back(I->Attrs); |
| 2770 | } |
| 2771 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 2772 | if (isVarArg) Params.pop_back(); |
| 2773 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2774 | FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, Attrs); |
| 2775 | delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list |
| 2776 | delete yyvsp[-4].TypeVal; // Delete the return type handle |
| 2777 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 2778 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2779 | ; |
| 2780 | break;} |
| 2781 | case 123: |
| 2782 | #line 1256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2783 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2784 | std::vector<const Type*> Params; |
| 2785 | std::vector<FunctionType::ParameterAttributes> Attrs; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2786 | Attrs.push_back(yyvsp[0].ParamAttrs); |
| 2787 | for (TypeWithAttrsList::iterator I=yyvsp[-2].TypeWithAttrsList->begin(), E=yyvsp[-2].TypeWithAttrsList->end(); I != E; ++I) { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2788 | Params.push_back(I->Ty->get()); |
| 2789 | if (I->Ty->get() != Type::VoidTy) |
| 2790 | Attrs.push_back(I->Attrs); |
| 2791 | } |
| 2792 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 2793 | if (isVarArg) Params.pop_back(); |
| 2794 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2795 | FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, Attrs); |
| 2796 | delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list |
| 2797 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2798 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2799 | ; |
| 2800 | break;} |
| 2801 | case 124: |
| 2802 | #line 1274 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2803 | { // Sized array type? |
| 2804 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); |
| 2805 | delete yyvsp[-1].TypeVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2806 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2807 | ; |
| 2808 | break;} |
| 2809 | case 125: |
| 2810 | #line 1279 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2811 | { // Packed array type? |
| 2812 | const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); |
| 2813 | if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2814 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 2815 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 2816 | GEN_ERROR("Element type of a PackedType must be primitive"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2817 | if (!isPowerOf2_32(yyvsp[-3].UInt64Val)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2818 | GEN_ERROR("Vector length should be a power of 2!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2819 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); |
| 2820 | delete yyvsp[-1].TypeVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2821 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2822 | ; |
| 2823 | break;} |
| 2824 | case 126: |
| 2825 | #line 1291 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2826 | { // Structure type? |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2827 | std::vector<const Type*> Elements; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2828 | for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(), |
| 2829 | E = yyvsp[-1].TypeList->end(); I != E; ++I) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2830 | Elements.push_back(*I); |
| 2831 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2832 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 2833 | delete yyvsp[-1].TypeList; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2834 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2835 | ; |
| 2836 | break;} |
| 2837 | case 127: |
| 2838 | #line 1301 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2839 | { // Empty structure type? |
| 2840 | yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2841 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2842 | ; |
| 2843 | break;} |
| 2844 | case 128: |
| 2845 | #line 1305 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2846 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2847 | std::vector<const Type*> Elements; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2848 | for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(), |
| 2849 | E = yyvsp[-2].TypeList->end(); I != E; ++I) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2850 | Elements.push_back(*I); |
| 2851 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2852 | yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 2853 | delete yyvsp[-2].TypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2854 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2855 | ; |
| 2856 | break;} |
| 2857 | case 129: |
| 2858 | #line 1315 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2859 | { // Empty structure type? |
| 2860 | yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2861 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2862 | ; |
| 2863 | break;} |
| 2864 | case 130: |
| 2865 | #line 1322 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2866 | { |
| 2867 | yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal; |
| 2868 | yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs; |
| 2869 | ; |
| 2870 | break;} |
| 2871 | case 131: |
| 2872 | #line 1329 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2873 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2874 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2875 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 2876 | if (!(*yyvsp[0].TypeVal)->isFirstClassType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2877 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2878 | yyval.TypeVal = yyvsp[0].TypeVal; |
| 2879 | ; |
| 2880 | break;} |
| 2881 | case 132: |
| 2882 | #line 1336 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2883 | { |
| 2884 | yyval.TypeVal = new PATypeHolder(Type::VoidTy); |
| 2885 | ; |
| 2886 | break;} |
| 2887 | case 133: |
| 2888 | #line 1341 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2889 | { |
| 2890 | yyval.TypeWithAttrsList = new TypeWithAttrsList(); |
| 2891 | yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 2892 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2893 | ; |
| 2894 | break;} |
| 2895 | case 134: |
| 2896 | #line 1346 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2897 | { |
| 2898 | (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2899 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2900 | ; |
| 2901 | break;} |
| 2902 | case 136: |
| 2903 | #line 1354 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2904 | { |
| 2905 | yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2906 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 2907 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2908 | yyval.TypeWithAttrsList->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2909 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2910 | ; |
| 2911 | break;} |
| 2912 | case 137: |
| 2913 | #line 1361 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2914 | { |
| 2915 | yyval.TypeWithAttrsList = new TypeWithAttrsList; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2916 | TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet; |
| 2917 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2918 | yyval.TypeWithAttrsList->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2919 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2920 | ; |
| 2921 | break;} |
| 2922 | case 138: |
| 2923 | #line 1368 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2924 | { |
| 2925 | yyval.TypeWithAttrsList = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2926 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2927 | ; |
| 2928 | break;} |
| 2929 | case 139: |
| 2930 | #line 1376 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2931 | { |
| 2932 | yyval.TypeList = new std::list<PATypeHolder>(); |
| 2933 | yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 2934 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2935 | ; |
| 2936 | break;} |
| 2937 | case 140: |
| 2938 | #line 1381 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2939 | { |
| 2940 | (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2941 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2942 | ; |
| 2943 | break;} |
| 2944 | case 141: |
| 2945 | #line 1392 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2946 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2947 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2948 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 2949 | const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2950 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 2951 | GEN_ERROR("Cannot make array constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2952 | (*yyvsp[-3].TypeVal)->getDescription() + "'!"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2953 | const Type *ETy = ATy->getElementType(); |
| 2954 | int NumElements = ATy->getNumElements(); |
| 2955 | |
| 2956 | // Verify that we have the correct size... |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2957 | if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2958 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2959 | utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2960 | itostr(NumElements) + "!"); |
| 2961 | |
| 2962 | // Verify all elements are correct type! |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2963 | for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { |
| 2964 | if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2965 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 2966 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2967 | (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2968 | } |
| 2969 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2970 | yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector); |
| 2971 | delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2972 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2973 | ; |
| 2974 | break;} |
| 2975 | case 142: |
| 2976 | #line 1420 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2977 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2978 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2979 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 2980 | const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 2981 | if (ATy == 0) |
| 2982 | GEN_ERROR("Cannot make array constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2983 | (*yyvsp[-2].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2984 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 2985 | int NumElements = ATy->getNumElements(); |
| 2986 | if (NumElements != -1 && NumElements != 0) |
| 2987 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
| 2988 | " arguments, but has size of " + itostr(NumElements) +"!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2989 | yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 2990 | delete yyvsp[-2].TypeVal; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 2991 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2992 | ; |
| 2993 | break;} |
| 2994 | case 143: |
| 2995 | #line 1436 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 2996 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 2997 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 2998 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 2999 | const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3000 | if (ATy == 0) |
| 3001 | GEN_ERROR("Cannot make array constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3002 | (*yyvsp[-2].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3003 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3004 | int NumElements = ATy->getNumElements(); |
| 3005 | const Type *ETy = ATy->getElementType(); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3006 | char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); |
| 3007 | if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3008 | GEN_ERROR("Can't build string constant of size " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3009 | itostr((int)(EndStr-yyvsp[0].StrVal)) + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3010 | " when array has size " + itostr(NumElements) + "!"); |
| 3011 | std::vector<Constant*> Vals; |
| 3012 | if (ETy == Type::Int8Ty) { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3013 | for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3014 | C != (unsigned char*)EndStr; ++C) |
| 3015 | Vals.push_back(ConstantInt::get(ETy, *C)); |
| 3016 | } else { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3017 | free(yyvsp[0].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3018 | GEN_ERROR("Cannot build string arrays of non byte sized elements!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3019 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3020 | free(yyvsp[0].StrVal); |
| 3021 | yyval.ConstVal = ConstantArray::get(ATy, Vals); |
| 3022 | delete yyvsp[-2].TypeVal; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3023 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3024 | ; |
| 3025 | break;} |
| 3026 | case 144: |
| 3027 | #line 1465 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3028 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3029 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3030 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 3031 | const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3032 | if (PTy == 0) |
| 3033 | GEN_ERROR("Cannot make packed constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3034 | (*yyvsp[-3].TypeVal)->getDescription() + "'!"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3035 | const Type *ETy = PTy->getElementType(); |
| 3036 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3037 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3038 | // Verify that we have the correct size... |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3039 | if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3040 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3041 | utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3042 | itostr(NumElements) + "!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3043 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3044 | // Verify all elements are correct type! |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3045 | for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { |
| 3046 | if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3047 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 3048 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3049 | (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3050 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3051 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3052 | yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector); |
| 3053 | delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3054 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3055 | ; |
| 3056 | break;} |
| 3057 | case 145: |
| 3058 | #line 1493 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3059 | { |
| 3060 | const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3061 | if (STy == 0) |
| 3062 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3063 | (*yyvsp[-3].TypeVal)->getDescription() + "'!"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3064 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3065 | if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3066 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3067 | |
| 3068 | // Check to ensure that constants are compatible with the type initializer! |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3069 | for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) |
| 3070 | if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3071 | GEN_ERROR("Expected type '" + |
| 3072 | STy->getElementType(i)->getDescription() + |
| 3073 | "' for element #" + utostr(i) + |
| 3074 | " of structure initializer!"); |
| 3075 | |
| 3076 | // Check to ensure that Type is not packed |
| 3077 | if (STy->isPacked()) |
| 3078 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3079 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3080 | yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector); |
| 3081 | delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3082 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3083 | ; |
| 3084 | break;} |
| 3085 | case 146: |
| 3086 | #line 1518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3087 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3088 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3089 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 3090 | const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3091 | if (STy == 0) |
| 3092 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3093 | (*yyvsp[-2].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3094 | |
| 3095 | if (STy->getNumContainedTypes() != 0) |
| 3096 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3097 | |
| 3098 | // Check to ensure that Type is not packed |
| 3099 | if (STy->isPacked()) |
| 3100 | GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'"); |
| 3101 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3102 | yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3103 | delete yyvsp[-2].TypeVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3104 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3105 | ; |
| 3106 | break;} |
| 3107 | case 147: |
| 3108 | #line 1537 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3109 | { |
| 3110 | const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3111 | if (STy == 0) |
| 3112 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3113 | (*yyvsp[-5].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3114 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3115 | if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes()) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3116 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3117 | |
| 3118 | // Check to ensure that constants are compatible with the type initializer! |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3119 | for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i) |
| 3120 | if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3121 | GEN_ERROR("Expected type '" + |
| 3122 | STy->getElementType(i)->getDescription() + |
| 3123 | "' for element #" + utostr(i) + |
| 3124 | " of structure initializer!"); |
| 3125 | |
| 3126 | // Check to ensure that Type is packed |
| 3127 | if (!STy->isPacked()) |
| 3128 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3129 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3130 | yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector); |
| 3131 | delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3132 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3133 | ; |
| 3134 | break;} |
| 3135 | case 148: |
| 3136 | #line 1562 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3137 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3138 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3139 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); |
| 3140 | const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3141 | if (STy == 0) |
| 3142 | GEN_ERROR("Cannot make struct constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3143 | (*yyvsp[-4].TypeVal)->getDescription() + "'!"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3144 | |
| 3145 | if (STy->getNumContainedTypes() != 0) |
| 3146 | GEN_ERROR("Illegal number of initializers for structure type!"); |
| 3147 | |
| 3148 | // Check to ensure that Type is packed |
| 3149 | if (!STy->isPacked()) |
| 3150 | GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'"); |
| 3151 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3152 | yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3153 | delete yyvsp[-4].TypeVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3154 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3155 | ; |
| 3156 | break;} |
| 3157 | case 149: |
| 3158 | #line 1581 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3159 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3160 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3161 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3162 | const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3163 | if (PTy == 0) |
| 3164 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3165 | (*yyvsp[-1].TypeVal)->getDescription() + "'!"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3166 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3167 | yyval.ConstVal = ConstantPointerNull::get(PTy); |
| 3168 | delete yyvsp[-1].TypeVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3169 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3170 | ; |
| 3171 | break;} |
| 3172 | case 150: |
| 3173 | #line 1593 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3174 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3175 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3176 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3177 | yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); |
| 3178 | delete yyvsp[-1].TypeVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3179 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3180 | ; |
| 3181 | break;} |
| 3182 | case 151: |
| 3183 | #line 1600 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3184 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3185 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3186 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3187 | const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3188 | if (Ty == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3189 | GEN_ERROR("Global const reference must be a pointer type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3190 | |
| 3191 | // ConstExprs can exist in the body of a function, thus creating |
| 3192 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3193 | // the context of a function, getValNonImprovising will search the functions |
| 3194 | // symbol table instead of the module symbol table for the global symbol, |
| 3195 | // which throws things all off. To get around this, we just tell |
| 3196 | // getValNonImprovising that we are at global scope here. |
| 3197 | // |
| 3198 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3199 | CurFun.CurrentFunction = 0; |
| 3200 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3201 | Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3202 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3203 | |
| 3204 | CurFun.CurrentFunction = SavedCurFn; |
| 3205 | |
| 3206 | // If this is an initializer for a constant pointer, which is referencing a |
| 3207 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3208 | // in the future with the right type of variable. |
| 3209 | // |
| 3210 | if (V == 0) { |
| 3211 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 3212 | const PointerType *PT = cast<PointerType>(Ty); |
| 3213 | |
| 3214 | // First check to see if the forward references value is already created! |
| 3215 | PerModuleInfo::GlobalRefsType::iterator I = |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3216 | CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3217 | |
| 3218 | if (I != CurModule.GlobalRefs.end()) { |
| 3219 | V = I->second; // Placeholder already exists, use it... |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3220 | yyvsp[0].ValIDVal.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3221 | } else { |
| 3222 | std::string Name; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3223 | if (yyvsp[0].ValIDVal.Type == ValID::GlobalName) |
| 3224 | Name = yyvsp[0].ValIDVal.Name; |
| 3225 | else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3226 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3227 | |
| 3228 | // Create the forward referenced global. |
| 3229 | GlobalValue *GV; |
| 3230 | if (const FunctionType *FTy = |
| 3231 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3232 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3233 | CurModule.CurrentModule); |
| 3234 | } else { |
| 3235 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3236 | GlobalValue::ExternalLinkage, 0, |
| 3237 | Name, CurModule.CurrentModule); |
| 3238 | } |
| 3239 | |
| 3240 | // Keep track of the fact that we have a forward ref to recycle it |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3241 | CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3242 | V = GV; |
| 3243 | } |
| 3244 | } |
| 3245 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3246 | yyval.ConstVal = cast<GlobalValue>(V); |
| 3247 | delete yyvsp[-1].TypeVal; // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3248 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3249 | ; |
| 3250 | break;} |
| 3251 | case 152: |
| 3252 | #line 1666 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3253 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3254 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3255 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3256 | if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3257 | GEN_ERROR("Mismatched types for constant expression: " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3258 | (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription()); |
| 3259 | yyval.ConstVal = yyvsp[0].ConstVal; |
| 3260 | delete yyvsp[-1].TypeVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3261 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3262 | ; |
| 3263 | break;} |
| 3264 | case 153: |
| 3265 | #line 1676 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3266 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3267 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3268 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3269 | const Type *Ty = yyvsp[-1].TypeVal->get(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3270 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 3271 | GEN_ERROR("Cannot create a null initialized value of this type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3272 | yyval.ConstVal = Constant::getNullValue(Ty); |
| 3273 | delete yyvsp[-1].TypeVal; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3274 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3275 | ; |
| 3276 | break;} |
| 3277 | case 154: |
| 3278 | #line 1686 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3279 | { // integral constants |
| 3280 | if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3281 | GEN_ERROR("Constant value doesn't fit in type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3282 | yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3283 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3284 | ; |
| 3285 | break;} |
| 3286 | case 155: |
| 3287 | #line 1692 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3288 | { // integral constants |
| 3289 | if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3290 | GEN_ERROR("Constant value doesn't fit in type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3291 | yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3292 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3293 | ; |
| 3294 | break;} |
| 3295 | case 156: |
| 3296 | #line 1698 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3297 | { // Boolean constants |
| 3298 | assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); |
| 3299 | yyval.ConstVal = ConstantInt::getTrue(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3300 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3301 | ; |
| 3302 | break;} |
| 3303 | case 157: |
| 3304 | #line 1703 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3305 | { // Boolean constants |
| 3306 | assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); |
| 3307 | yyval.ConstVal = ConstantInt::getFalse(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3308 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3309 | ; |
| 3310 | break;} |
| 3311 | case 158: |
| 3312 | #line 1708 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3313 | { // Float & Double constants |
| 3314 | if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3315 | GEN_ERROR("Floating point constant invalid for type!!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3316 | yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3317 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3318 | ; |
| 3319 | break;} |
| 3320 | case 159: |
| 3321 | #line 1716 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3322 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3323 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3324 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 3325 | Constant *Val = yyvsp[-3].ConstVal; |
| 3326 | const Type *DestTy = yyvsp[-1].TypeVal->get(); |
| 3327 | if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3328 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 3329 | Val->getType()->getDescription() + "' to '" + |
| 3330 | DestTy->getDescription() + "'!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3331 | yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy); |
| 3332 | delete yyvsp[-1].TypeVal; |
| 3333 | ; |
| 3334 | break;} |
| 3335 | case 160: |
| 3336 | #line 1728 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3337 | { |
| 3338 | if (!isa<PointerType>(yyvsp[-2].ConstVal->getType())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3339 | GEN_ERROR("GetElementPtr requires a pointer operand!"); |
| 3340 | |
| 3341 | const Type *IdxTy = |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3342 | GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3343 | if (!IdxTy) |
| 3344 | GEN_ERROR("Index list invalid for constant getelementptr!"); |
| 3345 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3346 | SmallVector<Constant*, 8> IdxVec; |
| 3347 | for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i) |
| 3348 | if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3349 | IdxVec.push_back(C); |
| 3350 | else |
| 3351 | GEN_ERROR("Indices to constant getelementptr must be constants!"); |
| 3352 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3353 | delete yyvsp[-1].ValueList; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3354 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3355 | yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3356 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3357 | ; |
| 3358 | break;} |
| 3359 | case 161: |
| 3360 | #line 1749 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3361 | { |
| 3362 | if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3363 | GEN_ERROR("Select condition must be of boolean type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3364 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3365 | GEN_ERROR("Select operand types must match!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3366 | yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3367 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3368 | ; |
| 3369 | break;} |
| 3370 | case 162: |
| 3371 | #line 1757 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3372 | { |
| 3373 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3374 | GEN_ERROR("Binary operator types must match!"); |
| 3375 | CHECK_FOR_ERROR; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3376 | yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
| 3377 | ; |
| 3378 | break;} |
| 3379 | case 163: |
| 3380 | #line 1763 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3381 | { |
| 3382 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3383 | GEN_ERROR("Logical operator types must match!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3384 | if (!yyvsp[-3].ConstVal->getType()->isInteger()) { |
| 3385 | if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()) || |
| 3386 | !cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3387 | GEN_ERROR("Logical operator requires integral operands!"); |
| 3388 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3389 | yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3390 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3391 | ; |
| 3392 | break;} |
| 3393 | case 164: |
| 3394 | #line 1774 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3395 | { |
| 3396 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3397 | GEN_ERROR("icmp operand types must match!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3398 | yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
| 3399 | ; |
| 3400 | break;} |
| 3401 | case 165: |
| 3402 | #line 1779 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3403 | { |
| 3404 | if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3405 | GEN_ERROR("fcmp operand types must match!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3406 | yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
| 3407 | ; |
| 3408 | break;} |
| 3409 | case 166: |
| 3410 | #line 1784 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3411 | { |
| 3412 | if (yyvsp[-1].ConstVal->getType() != Type::Int8Ty) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3413 | GEN_ERROR("Shift count for shift constant must be i8 type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3414 | if (!yyvsp[-3].ConstVal->getType()->isInteger()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3415 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 3416 | CHECK_FOR_ERROR; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3417 | yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3418 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3419 | ; |
| 3420 | break;} |
| 3421 | case 167: |
| 3422 | #line 1793 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3423 | { |
| 3424 | if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3425 | GEN_ERROR("Invalid extractelement operands!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3426 | yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3427 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3428 | ; |
| 3429 | break;} |
| 3430 | case 168: |
| 3431 | #line 1799 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3432 | { |
| 3433 | if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3434 | GEN_ERROR("Invalid insertelement operands!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3435 | yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3436 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3437 | ; |
| 3438 | break;} |
| 3439 | case 169: |
| 3440 | #line 1805 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3441 | { |
| 3442 | if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3443 | GEN_ERROR("Invalid shufflevector operands!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3444 | yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3445 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3446 | ; |
| 3447 | break;} |
| 3448 | case 170: |
| 3449 | #line 1814 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3450 | { |
| 3451 | (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3452 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3453 | ; |
| 3454 | break;} |
| 3455 | case 171: |
| 3456 | #line 1818 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3457 | { |
| 3458 | yyval.ConstVector = new std::vector<Constant*>(); |
| 3459 | yyval.ConstVector->push_back(yyvsp[0].ConstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3460 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3461 | ; |
| 3462 | break;} |
| 3463 | case 172: |
| 3464 | #line 1826 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3465 | { yyval.BoolVal = false; ; |
| 3466 | break;} |
| 3467 | case 173: |
| 3468 | #line 1826 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3469 | { yyval.BoolVal = true; ; |
| 3470 | break;} |
| 3471 | case 174: |
| 3472 | #line 1837 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3473 | { |
| 3474 | yyval.ModuleVal = ParserResult = CurModule.CurrentModule; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3475 | CurModule.ModuleDone(); |
| 3476 | CHECK_FOR_ERROR; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3477 | ; |
| 3478 | break;} |
| 3479 | case 175: |
| 3480 | #line 1842 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3481 | { |
| 3482 | yyval.ModuleVal = ParserResult = CurModule.CurrentModule; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3483 | CurModule.ModuleDone(); |
| 3484 | CHECK_FOR_ERROR; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3485 | ; |
| 3486 | break;} |
| 3487 | case 178: |
| 3488 | #line 1855 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3489 | { CurFun.isDeclare = false; ; |
| 3490 | break;} |
| 3491 | case 179: |
| 3492 | #line 1855 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3493 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3494 | CurFun.FunctionDone(); |
| 3495 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3496 | ; |
| 3497 | break;} |
| 3498 | case 180: |
| 3499 | #line 1859 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3500 | { CurFun.isDeclare = true; ; |
| 3501 | break;} |
| 3502 | case 181: |
| 3503 | #line 1859 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3504 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3505 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3506 | ; |
| 3507 | break;} |
| 3508 | case 182: |
| 3509 | #line 1862 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3510 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3511 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3512 | ; |
| 3513 | break;} |
| 3514 | case 183: |
| 3515 | #line 1865 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3516 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3517 | // Emit an error if there are any unresolved types left. |
| 3518 | if (!CurModule.LateResolveTypes.empty()) { |
| 3519 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3520 | if (DID.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3521 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 3522 | } else { |
| 3523 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 3524 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3525 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3526 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3527 | ; |
| 3528 | break;} |
| 3529 | case 184: |
| 3530 | #line 1877 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3531 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3532 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3533 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3534 | // Eagerly resolve types. This is not an optimization, this is a |
| 3535 | // requirement that is due to the fact that we could have this: |
| 3536 | // |
| 3537 | // %list = type { %list * } |
| 3538 | // %list = type { %list * } ; repeated type decl |
| 3539 | // |
| 3540 | // If types are not resolved eagerly, then the two types will not be |
| 3541 | // determined to be the same type! |
| 3542 | // |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3543 | ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3544 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3545 | if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3546 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3547 | // If this is a named type that is not a redefinition, add it to the slot |
| 3548 | // table. |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3549 | CurModule.Types.push_back(*yyvsp[0].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3550 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3551 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3552 | delete yyvsp[0].TypeVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3553 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3554 | ; |
| 3555 | break;} |
| 3556 | case 185: |
| 3557 | #line 1901 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3558 | { |
| 3559 | ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3560 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3561 | if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3562 | CHECK_FOR_ERROR |
| 3563 | // If this is a named type that is not a redefinition, add it to the slot |
| 3564 | // table. |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3565 | CurModule.Types.push_back(yyvsp[0].PrimType); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3566 | } |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3567 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3568 | ; |
| 3569 | break;} |
| 3570 | case 186: |
| 3571 | #line 1912 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3572 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3573 | /* "Externally Visible" Linkage */ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3574 | if (yyvsp[0].ConstVal == 0) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3575 | GEN_ERROR("Global value initializer is not a constant!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3576 | CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, |
| 3577 | yyvsp[-2].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3578 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3579 | ; |
| 3580 | break;} |
| 3581 | case 187: |
| 3582 | #line 1919 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3583 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3584 | CurGV = 0; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3585 | ; |
| 3586 | break;} |
| 3587 | case 188: |
| 3588 | #line 1922 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3589 | { |
| 3590 | if (yyvsp[0].ConstVal == 0) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3591 | GEN_ERROR("Global value initializer is not a constant!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3592 | CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, yyvsp[-3].Linkage, yyvsp[-2].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3593 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3594 | ; |
| 3595 | break;} |
| 3596 | case 189: |
| 3597 | #line 1927 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3598 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3599 | CurGV = 0; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3600 | ; |
| 3601 | break;} |
| 3602 | case 190: |
| 3603 | #line 1930 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3604 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3605 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3606 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 3607 | CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, yyvsp[-3].Linkage, yyvsp[-2].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3608 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3609 | delete yyvsp[0].TypeVal; |
| 3610 | ; |
| 3611 | break;} |
| 3612 | case 191: |
| 3613 | #line 1936 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3614 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3615 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3616 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3617 | ; |
| 3618 | break;} |
| 3619 | case 192: |
| 3620 | #line 1940 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3621 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3622 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3623 | ; |
| 3624 | break;} |
| 3625 | case 193: |
| 3626 | #line 1943 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3627 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3628 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3629 | ; |
| 3630 | break;} |
| 3631 | case 194: |
| 3632 | #line 1949 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3633 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 3634 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3635 | char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); |
| 3636 | std::string NewAsm(yyvsp[0].StrVal, EndStr); |
| 3637 | free(yyvsp[0].StrVal); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 3638 | |
| 3639 | if (AsmSoFar.empty()) |
| 3640 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 3641 | else |
| 3642 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3643 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3644 | ; |
| 3645 | break;} |
| 3646 | case 195: |
| 3647 | #line 1962 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3648 | { |
| 3649 | CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); |
| 3650 | free(yyvsp[0].StrVal); |
| 3651 | ; |
| 3652 | break;} |
| 3653 | case 196: |
| 3654 | #line 1966 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3655 | { |
| 3656 | CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); |
| 3657 | free(yyvsp[0].StrVal); |
| 3658 | ; |
| 3659 | break;} |
| 3660 | case 198: |
| 3661 | #line 1973 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3662 | { |
| 3663 | CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); |
| 3664 | free(yyvsp[0].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3665 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3666 | ; |
| 3667 | break;} |
| 3668 | case 199: |
| 3669 | #line 1978 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3670 | { |
| 3671 | CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); |
| 3672 | free(yyvsp[0].StrVal); |
Reid Spencer | a54b7cb | 2007-01-12 07:05:14 +0000 | [diff] [blame] | 3673 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3674 | ; |
| 3675 | break;} |
| 3676 | case 200: |
| 3677 | #line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3678 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3679 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3680 | ; |
| 3681 | break;} |
| 3682 | case 201: |
| 3683 | #line 1992 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3684 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3685 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3686 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 3687 | if (*yyvsp[-2].TypeVal == Type::VoidTy) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3688 | GEN_ERROR("void typed arguments are invalid!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3689 | ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal; |
| 3690 | yyval.ArgList = yyvsp[-4].ArgList; |
| 3691 | yyvsp[-4].ArgList->push_back(E); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3692 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3693 | ; |
| 3694 | break;} |
| 3695 | case 202: |
| 3696 | #line 2002 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3697 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3698 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3699 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 3700 | if (*yyvsp[-2].TypeVal == Type::VoidTy) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3701 | GEN_ERROR("void typed arguments are invalid!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3702 | ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal; |
| 3703 | yyval.ArgList = new ArgListType; |
| 3704 | yyval.ArgList->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3705 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3706 | ; |
| 3707 | break;} |
| 3708 | case 203: |
| 3709 | #line 2013 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3710 | { |
| 3711 | yyval.ArgList = yyvsp[0].ArgList; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3712 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3713 | ; |
| 3714 | break;} |
| 3715 | case 204: |
| 3716 | #line 2017 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3717 | { |
| 3718 | yyval.ArgList = yyvsp[-2].ArgList; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3719 | struct ArgListEntry E; |
| 3720 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 3721 | E.Name = 0; |
| 3722 | E.Attrs = FunctionType::NoAttributeSet; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3723 | yyval.ArgList->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3724 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3725 | ; |
| 3726 | break;} |
| 3727 | case 205: |
| 3728 | #line 2026 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3729 | { |
| 3730 | yyval.ArgList = new ArgListType; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3731 | struct ArgListEntry E; |
| 3732 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 3733 | E.Name = 0; |
| 3734 | E.Attrs = FunctionType::NoAttributeSet; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3735 | yyval.ArgList->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3736 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3737 | ; |
| 3738 | break;} |
| 3739 | case 206: |
| 3740 | #line 2035 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3741 | { |
| 3742 | yyval.ArgList = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3743 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3744 | ; |
| 3745 | break;} |
| 3746 | case 207: |
| 3747 | #line 2041 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3748 | { |
| 3749 | UnEscapeLexed(yyvsp[-6].StrVal); |
| 3750 | std::string FunctionName(yyvsp[-6].StrVal); |
| 3751 | free(yyvsp[-6].StrVal); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3752 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3753 | // Check the function result for abstractness if this is a define. We should |
| 3754 | // have no abstract types at this point |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3755 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal)) |
| 3756 | GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3757 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3758 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3759 | std::vector<FunctionType::ParameterAttributes> ParamAttrs; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3760 | ParamAttrs.push_back(yyvsp[-2].ParamAttrs); |
| 3761 | if (yyvsp[-4].ArgList) { // If there are arguments... |
| 3762 | for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3763 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 3764 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 3765 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3766 | ParamTypeList.push_back(Ty); |
| 3767 | if (Ty != Type::VoidTy) |
| 3768 | ParamAttrs.push_back(I->Attrs); |
| 3769 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3770 | } |
| 3771 | |
| 3772 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 3773 | if (isVarArg) ParamTypeList.pop_back(); |
| 3774 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3775 | FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3776 | ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3777 | const PointerType *PFT = PointerType::get(FT); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3778 | delete yyvsp[-7].TypeVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3779 | |
| 3780 | ValID ID; |
| 3781 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3782 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3783 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3784 | ID = ValID::createGlobalID(CurModule.Values[PFT].size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3785 | } |
| 3786 | |
| 3787 | Function *Fn = 0; |
| 3788 | // See if this function was forward referenced. If so, recycle the object. |
| 3789 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 3790 | // Move the function to the end of the list, from whereever it was |
| 3791 | // previously inserted. |
| 3792 | Fn = cast<Function>(FWRef); |
| 3793 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 3794 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 3795 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 3796 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 3797 | // If this is the case, either we need to be a forward decl, or it needs |
| 3798 | // to be. |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 3799 | if (!CurFun.isDeclare && !Fn->isDeclaration()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3800 | GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3801 | |
| 3802 | // Make sure to strip off any argument names so we can't get conflicts. |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 3803 | if (Fn->isDeclaration()) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3804 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 3805 | AI != AE; ++AI) |
| 3806 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3807 | } else { // Not already defined? |
| 3808 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 3809 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 3810 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3811 | InsertValue(Fn, CurModule.Values); |
| 3812 | } |
| 3813 | |
| 3814 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 3815 | |
| 3816 | if (CurFun.isDeclare) { |
| 3817 | // If we have declaration, always overwrite linkage. This will allow us to |
| 3818 | // correctly handle cases, when pointer to function is passed as argument to |
| 3819 | // another function. |
| 3820 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 3821 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 3822 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3823 | Fn->setCallingConv(yyvsp[-8].UIntVal); |
| 3824 | Fn->setAlignment(yyvsp[0].UIntVal); |
| 3825 | if (yyvsp[-1].StrVal) { |
| 3826 | Fn->setSection(yyvsp[-1].StrVal); |
| 3827 | free(yyvsp[-1].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 3828 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3829 | |
| 3830 | // Add all of the arguments we parsed to the function... |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3831 | if (yyvsp[-4].ArgList) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3832 | if (isVarArg) { // Nuke the last entry |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3833 | assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0&& |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3834 | "Not a varargs marker!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3835 | delete yyvsp[-4].ArgList->back().Ty; |
| 3836 | yyvsp[-4].ArgList->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3837 | } |
| 3838 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3839 | unsigned Idx = 1; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3840 | for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3841 | delete I->Ty; // Delete the typeholder... |
| 3842 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3843 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3844 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 3845 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3846 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3847 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3848 | delete yyvsp[-4].ArgList; // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3849 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3850 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3851 | ; |
| 3852 | break;} |
| 3853 | case 210: |
| 3854 | #line 2148 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3855 | { |
| 3856 | yyval.FunctionVal = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3857 | |
| 3858 | // Make sure that we keep track of the linkage type even if there was a |
| 3859 | // previous "declare". |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3860 | yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage); |
| 3861 | yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility); |
| 3862 | ; |
| 3863 | break;} |
| 3864 | case 213: |
| 3865 | #line 2159 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3866 | { |
| 3867 | yyval.FunctionVal = yyvsp[-1].FunctionVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3868 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3869 | ; |
| 3870 | break;} |
| 3871 | case 214: |
| 3872 | #line 2164 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3873 | { |
| 3874 | CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage); |
| 3875 | CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility); |
| 3876 | yyval.FunctionVal = CurFun.CurrentFunction; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3877 | CurFun.FunctionDone(); |
| 3878 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3879 | ; |
| 3880 | break;} |
| 3881 | case 215: |
| 3882 | #line 2176 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3883 | { |
| 3884 | yyval.BoolVal = false; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3885 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3886 | ; |
| 3887 | break;} |
| 3888 | case 216: |
| 3889 | #line 2180 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3890 | { |
| 3891 | yyval.BoolVal = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3892 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3893 | ; |
| 3894 | break;} |
| 3895 | case 217: |
| 3896 | #line 2185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3897 | { // A reference to a direct constant |
| 3898 | yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3899 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3900 | ; |
| 3901 | break;} |
| 3902 | case 218: |
| 3903 | #line 2189 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3904 | { |
| 3905 | yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 3906 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3907 | ; |
| 3908 | break;} |
| 3909 | case 219: |
| 3910 | #line 2193 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3911 | { // Perhaps it's an FP constant? |
| 3912 | yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 3913 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3914 | ; |
| 3915 | break;} |
| 3916 | case 220: |
| 3917 | #line 2197 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3918 | { |
| 3919 | yyval.ValIDVal = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3920 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3921 | ; |
| 3922 | break;} |
| 3923 | case 221: |
| 3924 | #line 2201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3925 | { |
| 3926 | yyval.ValIDVal = ValID::create(ConstantInt::getFalse()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 3927 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3928 | ; |
| 3929 | break;} |
| 3930 | case 222: |
| 3931 | #line 2205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3932 | { |
| 3933 | yyval.ValIDVal = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3934 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3935 | ; |
| 3936 | break;} |
| 3937 | case 223: |
| 3938 | #line 2209 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3939 | { |
| 3940 | yyval.ValIDVal = ValID::createUndef(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 3941 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3942 | ; |
| 3943 | break;} |
| 3944 | case 224: |
| 3945 | #line 2213 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3946 | { // A vector zero constant. |
| 3947 | yyval.ValIDVal = ValID::createZeroInit(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3948 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3949 | ; |
| 3950 | break;} |
| 3951 | case 225: |
| 3952 | #line 2217 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3953 | { // Nonempty unsized packed vector |
| 3954 | const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); |
| 3955 | int NumElements = yyvsp[-1].ConstVector->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3956 | |
| 3957 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 3958 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3959 | HandleUpRefs( |
| 3960 | PackedType::get( |
| 3961 | ETy, |
| 3962 | NumElements) |
| 3963 | ) |
| 3964 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3965 | |
| 3966 | // Verify all elements are correct type! |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3967 | for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { |
| 3968 | if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3969 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3970 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3971 | (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3972 | } |
| 3973 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3974 | yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector)); |
| 3975 | delete PTy; delete yyvsp[-1].ConstVector; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3976 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3977 | ; |
| 3978 | break;} |
| 3979 | case 226: |
| 3980 | #line 2242 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3981 | { |
| 3982 | yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3983 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3984 | ; |
| 3985 | break;} |
| 3986 | case 227: |
| 3987 | #line 2246 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3988 | { |
| 3989 | char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); |
| 3990 | std::string AsmStr = std::string(yyvsp[-2].StrVal, End); |
| 3991 | End = UnEscapeLexed(yyvsp[0].StrVal, true); |
| 3992 | std::string Constraints = std::string(yyvsp[0].StrVal, End); |
| 3993 | yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); |
| 3994 | free(yyvsp[-2].StrVal); |
| 3995 | free(yyvsp[0].StrVal); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 3996 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 3997 | ; |
| 3998 | break;} |
| 3999 | case 228: |
| 4000 | #line 2260 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4001 | { // Is it an integer reference...? |
| 4002 | yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4003 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4004 | ; |
| 4005 | break;} |
| 4006 | case 229: |
| 4007 | #line 2264 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4008 | { |
| 4009 | yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4010 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4011 | ; |
| 4012 | break;} |
| 4013 | case 230: |
| 4014 | #line 2268 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4015 | { // Is it a named reference...? |
| 4016 | yyval.ValIDVal = ValID::createLocalName(yyvsp[0].StrVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4017 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4018 | ; |
| 4019 | break;} |
| 4020 | case 231: |
| 4021 | #line 2272 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4022 | { // Is it a named reference...? |
| 4023 | yyval.ValIDVal = ValID::createGlobalName(yyvsp[0].StrVal); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4024 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4025 | ; |
| 4026 | break;} |
| 4027 | case 234: |
| 4028 | #line 2284 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4029 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4030 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4031 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 4032 | yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); |
| 4033 | delete yyvsp[-1].TypeVal; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4034 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4035 | ; |
| 4036 | break;} |
| 4037 | case 235: |
| 4038 | #line 2293 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4039 | { |
| 4040 | yyval.FunctionVal = yyvsp[-1].FunctionVal; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4041 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4042 | ; |
| 4043 | break;} |
| 4044 | case 236: |
| 4045 | #line 2297 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4046 | { // Do not allow functions with 0 basic blocks |
| 4047 | yyval.FunctionVal = yyvsp[-1].FunctionVal; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4048 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4049 | ; |
| 4050 | break;} |
| 4051 | case 237: |
| 4052 | #line 2306 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4053 | { |
| 4054 | setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4055 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4056 | InsertValue(yyvsp[0].TermInstVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4057 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4058 | yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); |
| 4059 | InsertValue(yyvsp[-2].BasicBlockVal); |
| 4060 | yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 4061 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4062 | ; |
| 4063 | break;} |
| 4064 | case 238: |
| 4065 | #line 2317 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4066 | { |
| 4067 | if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4068 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4069 | if (CI2->getParent() == 0) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4070 | yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2); |
| 4071 | yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); |
| 4072 | yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4073 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4074 | ; |
| 4075 | break;} |
| 4076 | case 239: |
| 4077 | #line 2326 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4078 | { |
| 4079 | yyval.BasicBlockVal = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4080 | CHECK_FOR_ERROR |
| 4081 | |
| 4082 | // Make sure to move the basic block to the correct location in the |
| 4083 | // function, instead of leaving it inserted wherever it was first |
| 4084 | // referenced. |
| 4085 | Function::BasicBlockListType &BBL = |
| 4086 | CurFun.CurrentFunction->getBasicBlockList(); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4087 | BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4088 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4089 | ; |
| 4090 | break;} |
| 4091 | case 240: |
| 4092 | #line 2338 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4093 | { |
| 4094 | yyval.BasicBlockVal = getBBVal(ValID::createLocalName(yyvsp[0].StrVal), true); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4095 | CHECK_FOR_ERROR |
| 4096 | |
| 4097 | // Make sure to move the basic block to the correct location in the |
| 4098 | // function, instead of leaving it inserted wherever it was first |
| 4099 | // referenced. |
| 4100 | Function::BasicBlockListType &BBL = |
| 4101 | CurFun.CurrentFunction->getBasicBlockList(); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4102 | BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4103 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4104 | ; |
| 4105 | break;} |
| 4106 | case 241: |
| 4107 | #line 2351 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4108 | { // Return with a result... |
| 4109 | yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); |
| 4110 | CHECK_FOR_ERROR |
| 4111 | ; |
| 4112 | break;} |
| 4113 | case 242: |
| 4114 | #line 2355 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4115 | { // Return with no result... |
| 4116 | yyval.TermInstVal = new ReturnInst(); |
| 4117 | CHECK_FOR_ERROR |
| 4118 | ; |
| 4119 | break;} |
| 4120 | case 243: |
| 4121 | #line 2359 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4122 | { // Unconditional Branch... |
| 4123 | BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); |
| 4124 | CHECK_FOR_ERROR |
| 4125 | yyval.TermInstVal = new BranchInst(tmpBB); |
| 4126 | ; |
| 4127 | break;} |
| 4128 | case 244: |
| 4129 | #line 2364 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4130 | { |
| 4131 | assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?"); |
| 4132 | BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); |
| 4133 | CHECK_FOR_ERROR |
| 4134 | BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal); |
| 4135 | CHECK_FOR_ERROR |
| 4136 | Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal); |
| 4137 | CHECK_FOR_ERROR |
| 4138 | yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 4139 | ; |
| 4140 | break;} |
| 4141 | case 245: |
| 4142 | #line 2374 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4143 | { |
| 4144 | Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); |
| 4145 | CHECK_FOR_ERROR |
| 4146 | BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal); |
| 4147 | CHECK_FOR_ERROR |
| 4148 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size()); |
| 4149 | yyval.TermInstVal = S; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4150 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4151 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(), |
| 4152 | E = yyvsp[-1].JumpTable->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4153 | for (; I != E; ++I) { |
| 4154 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4155 | S->addCase(CI, I->second); |
| 4156 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4157 | GEN_ERROR("Switch case is constant, but not a simple integer!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4158 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4159 | delete yyvsp[-1].JumpTable; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4160 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4161 | ; |
| 4162 | break;} |
| 4163 | case 246: |
| 4164 | #line 2393 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4165 | { |
| 4166 | Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4167 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4168 | BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4169 | CHECK_FOR_ERROR |
| 4170 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4171 | yyval.TermInstVal = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4172 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4173 | ; |
| 4174 | break;} |
| 4175 | case 247: |
| 4176 | #line 2403 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4177 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4178 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4179 | // Handle the short syntax |
| 4180 | const PointerType *PFTy = 0; |
| 4181 | const FunctionType *Ty = 0; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4182 | if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4183 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 4184 | // Pull out the types of all of the arguments... |
| 4185 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4186 | FunctionType::ParamAttrsList ParamAttrs; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4187 | ParamAttrs.push_back(yyvsp[-6].ParamAttrs); |
| 4188 | for (ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end(); I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4189 | const Type *Ty = I->Val->getType(); |
| 4190 | if (Ty == Type::VoidTy) |
| 4191 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 4192 | ParamTypes.push_back(Ty); |
| 4193 | ParamAttrs.push_back(I->Attrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4194 | } |
| 4195 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4196 | Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, ParamAttrs); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4197 | PFTy = PointerType::get(Ty); |
| 4198 | } |
| 4199 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4200 | Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4201 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4202 | BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4203 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4204 | BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4205 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4206 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4207 | // Check the arguments |
| 4208 | ValueList Args; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4209 | if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4210 | // Make sure no arguments is a good thing! |
| 4211 | if (Ty->getNumParams() != 0) |
| 4212 | GEN_ERROR("No arguments passed to a function that " |
| 4213 | "expects arguments!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4214 | } else { // Has arguments? |
| 4215 | // Loop through FunctionType's arguments and ensure they are specified |
| 4216 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4217 | FunctionType::param_iterator I = Ty->param_begin(); |
| 4218 | FunctionType::param_iterator E = Ty->param_end(); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4219 | ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4220 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4221 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 4222 | if (ArgI->Val->getType() != *I) |
| 4223 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4224 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4225 | Args.push_back(ArgI->Val); |
| 4226 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4227 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4228 | if (Ty->isVarArg()) { |
| 4229 | if (I == E) |
| 4230 | for (; ArgI != ArgE; ++ArgI) |
| 4231 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 4232 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4233 | GEN_ERROR("Invalid number of parameters detected!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4234 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4235 | |
| 4236 | // Create the InvokeInst |
| 4237 | InvokeInst *II = new InvokeInst(V, Normal, Except, Args); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4238 | II->setCallingConv(yyvsp[-12].UIntVal); |
| 4239 | yyval.TermInstVal = II; |
| 4240 | delete yyvsp[-8].ValueRefList; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4241 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4242 | ; |
| 4243 | break;} |
| 4244 | case 248: |
| 4245 | #line 2469 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4246 | { |
| 4247 | yyval.TermInstVal = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4248 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4249 | ; |
| 4250 | break;} |
| 4251 | case 249: |
| 4252 | #line 2473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4253 | { |
| 4254 | yyval.TermInstVal = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4255 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4256 | ; |
| 4257 | break;} |
| 4258 | case 250: |
| 4259 | #line 2480 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4260 | { |
| 4261 | yyval.JumpTable = yyvsp[-5].JumpTable; |
| 4262 | Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4263 | CHECK_FOR_ERROR |
| 4264 | if (V == 0) |
| 4265 | GEN_ERROR("May only switch on a constant pool value!"); |
| 4266 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4267 | BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4268 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4269 | yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); |
| 4270 | ; |
| 4271 | break;} |
| 4272 | case 251: |
| 4273 | #line 2491 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4274 | { |
| 4275 | yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 4276 | Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4277 | CHECK_FOR_ERROR |
| 4278 | |
| 4279 | if (V == 0) |
| 4280 | GEN_ERROR("May only switch on a constant pool value!"); |
| 4281 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4282 | BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4283 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4284 | yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); |
| 4285 | ; |
| 4286 | break;} |
| 4287 | case 252: |
| 4288 | #line 2504 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4289 | { |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4290 | // Is this definition named?? if so, assign the name... |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4291 | setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4292 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4293 | InsertValue(yyvsp[0].InstVal); |
| 4294 | yyval.InstVal = yyvsp[0].InstVal; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4295 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4296 | ; |
| 4297 | break;} |
| 4298 | case 253: |
| 4299 | #line 2513 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4300 | { // Used for PHI nodes |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4301 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4302 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription()); |
| 4303 | yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 4304 | Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4305 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4306 | BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4307 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4308 | yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB)); |
| 4309 | delete yyvsp[-5].TypeVal; |
| 4310 | ; |
| 4311 | break;} |
| 4312 | case 254: |
| 4313 | #line 2524 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4314 | { |
| 4315 | yyval.PHIList = yyvsp[-6].PHIList; |
| 4316 | Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4317 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4318 | BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4319 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4320 | yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB)); |
| 4321 | ; |
| 4322 | break;} |
| 4323 | case 255: |
| 4324 | #line 2534 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4325 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4326 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4327 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4328 | // Used for call and invoke instructions |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4329 | yyval.ValueRefList = new ValueRefList(); |
| 4330 | ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal); |
| 4331 | yyval.ValueRefList->push_back(E); |
| 4332 | ; |
| 4333 | break;} |
| 4334 | case 256: |
| 4335 | #line 2542 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4336 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4337 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4338 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 4339 | yyval.ValueRefList = yyvsp[-4].ValueRefList; |
| 4340 | ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal); |
| 4341 | yyval.ValueRefList->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4342 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4343 | ; |
| 4344 | break;} |
| 4345 | case 257: |
| 4346 | #line 2550 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4347 | { yyval.ValueRefList = new ValueRefList(); ; |
| 4348 | break;} |
| 4349 | case 258: |
| 4350 | #line 2553 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4351 | { yyval.ValueList = new std::vector<Value*>(); ; |
| 4352 | break;} |
| 4353 | case 259: |
| 4354 | #line 2554 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4355 | { |
| 4356 | yyval.ValueList = yyvsp[-2].ValueList; |
| 4357 | yyval.ValueList->push_back(yyvsp[0].ValueVal); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4358 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4359 | ; |
| 4360 | break;} |
| 4361 | case 260: |
| 4362 | #line 2561 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4363 | { |
| 4364 | yyval.BoolVal = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4365 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4366 | ; |
| 4367 | break;} |
| 4368 | case 261: |
| 4369 | #line 2565 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4370 | { |
| 4371 | yyval.BoolVal = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4372 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4373 | ; |
| 4374 | break;} |
| 4375 | case 262: |
| 4376 | #line 2570 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4377 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4378 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4379 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 4380 | if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && |
| 4381 | !isa<PackedType>((*yyvsp[-3].TypeVal).get())) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4382 | GEN_ERROR( |
| 4383 | "Arithmetic operator requires integer, FP, or packed operands!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4384 | if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) && |
| 4385 | (yyvsp[-4].BinaryOpVal == Instruction::URem || |
| 4386 | yyvsp[-4].BinaryOpVal == Instruction::SRem || |
| 4387 | yyvsp[-4].BinaryOpVal == Instruction::FRem)) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4388 | GEN_ERROR("U/S/FRem not supported on packed types!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4389 | Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4390 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4391 | Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4392 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4393 | yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2); |
| 4394 | if (yyval.InstVal == 0) |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4395 | GEN_ERROR("binary operator returned null!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4396 | delete yyvsp[-3].TypeVal; |
| 4397 | ; |
| 4398 | break;} |
| 4399 | case 263: |
| 4400 | #line 2591 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4401 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4402 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4403 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 4404 | if (!(*yyvsp[-3].TypeVal)->isInteger()) { |
| 4405 | if (!isa<PackedType>(yyvsp[-3].TypeVal->get()) || |
| 4406 | !cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4407 | GEN_ERROR("Logical operator requires integral operands!"); |
| 4408 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4409 | Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4410 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4411 | Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4412 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4413 | yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); |
| 4414 | if (yyval.InstVal == 0) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4415 | GEN_ERROR("binary operator returned null!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4416 | delete yyvsp[-3].TypeVal; |
| 4417 | ; |
| 4418 | break;} |
| 4419 | case 264: |
| 4420 | #line 2608 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4421 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4422 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4423 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 4424 | if (isa<PackedType>((*yyvsp[-3].TypeVal).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 4425 | GEN_ERROR("Packed types not supported by icmp instruction"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4426 | Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4427 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4428 | Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4429 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4430 | yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2); |
| 4431 | if (yyval.InstVal == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4432 | GEN_ERROR("icmp operator returned null!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4433 | ; |
| 4434 | break;} |
| 4435 | case 265: |
| 4436 | #line 2621 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4437 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4438 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4439 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); |
| 4440 | if (isa<PackedType>((*yyvsp[-3].TypeVal).get())) |
Reid Spencer | ac4a1dd | 2007-01-04 02:57:52 +0000 | [diff] [blame] | 4441 | GEN_ERROR("Packed types not supported by fcmp instruction"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4442 | Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4443 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4444 | Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4445 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4446 | yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2); |
| 4447 | if (yyval.InstVal == 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4448 | GEN_ERROR("fcmp operator returned null!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4449 | ; |
| 4450 | break;} |
| 4451 | case 266: |
| 4452 | #line 2634 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4453 | { |
| 4454 | if (yyvsp[0].ValueVal->getType() != Type::Int8Ty) |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4455 | GEN_ERROR("Shift amount must be i8 type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4456 | if (!yyvsp[-2].ValueVal->getType()->isInteger()) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4457 | GEN_ERROR("Shift constant expression requires integer operand!"); |
| 4458 | CHECK_FOR_ERROR; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4459 | yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4460 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4461 | ; |
| 4462 | break;} |
| 4463 | case 267: |
| 4464 | #line 2643 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4465 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4466 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4467 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 4468 | Value* Val = yyvsp[-2].ValueVal; |
| 4469 | const Type* DestTy = yyvsp[0].TypeVal->get(); |
| 4470 | if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4471 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4472 | Val->getType()->getDescription() + "' to '" + |
| 4473 | DestTy->getDescription() + "'!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4474 | yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy); |
| 4475 | delete yyvsp[0].TypeVal; |
| 4476 | ; |
| 4477 | break;} |
| 4478 | case 268: |
| 4479 | #line 2655 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4480 | { |
| 4481 | if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4482 | GEN_ERROR("select condition must be boolean!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4483 | if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4484 | GEN_ERROR("select value types should match!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4485 | yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4486 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4487 | ; |
| 4488 | break;} |
| 4489 | case 269: |
| 4490 | #line 2663 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4491 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4492 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4493 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); |
| 4494 | yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); |
| 4495 | delete yyvsp[0].TypeVal; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4496 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4497 | ; |
| 4498 | break;} |
| 4499 | case 270: |
| 4500 | #line 2670 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4501 | { |
| 4502 | if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4503 | GEN_ERROR("Invalid extractelement operands!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4504 | yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4505 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4506 | ; |
| 4507 | break;} |
| 4508 | case 271: |
| 4509 | #line 2676 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4510 | { |
| 4511 | if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4512 | GEN_ERROR("Invalid insertelement operands!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4513 | yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4514 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4515 | ; |
| 4516 | break;} |
| 4517 | case 272: |
| 4518 | #line 2682 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4519 | { |
| 4520 | if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4521 | GEN_ERROR("Invalid shufflevector operands!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4522 | yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4523 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4524 | ; |
| 4525 | break;} |
| 4526 | case 273: |
| 4527 | #line 2688 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4528 | { |
| 4529 | const Type *Ty = yyvsp[0].PHIList->front().first->getType(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4530 | if (!Ty->isFirstClassType()) |
| 4531 | GEN_ERROR("PHI node operands must be of first class type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4532 | yyval.InstVal = new PHINode(Ty); |
| 4533 | ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size()); |
| 4534 | while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) { |
| 4535 | if (yyvsp[0].PHIList->front().first->getType() != Ty) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4536 | GEN_ERROR("All elements of a PHI node must be of the same type!"); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4537 | cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second); |
| 4538 | yyvsp[0].PHIList->pop_front(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4539 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4540 | delete yyvsp[0].PHIList; // Free the list... |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4541 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4542 | ; |
| 4543 | break;} |
| 4544 | case 274: |
| 4545 | #line 2704 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4546 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4547 | |
| 4548 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4549 | const PointerType *PFTy = 0; |
| 4550 | const FunctionType *Ty = 0; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4551 | if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4552 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 4553 | // Pull out the types of all of the arguments... |
| 4554 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4555 | FunctionType::ParamAttrsList ParamAttrs; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4556 | ParamAttrs.push_back(yyvsp[0].ParamAttrs); |
| 4557 | for (ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end(); I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4558 | const Type *Ty = I->Val->getType(); |
| 4559 | if (Ty == Type::VoidTy) |
| 4560 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 4561 | ParamTypes.push_back(Ty); |
| 4562 | ParamAttrs.push_back(I->Attrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4563 | } |
| 4564 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4565 | Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, ParamAttrs); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4566 | PFTy = PointerType::get(Ty); |
| 4567 | } |
| 4568 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4569 | Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4570 | CHECK_FOR_ERROR |
| 4571 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4572 | // Check the arguments |
| 4573 | ValueList Args; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4574 | if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4575 | // Make sure no arguments is a good thing! |
| 4576 | if (Ty->getNumParams() != 0) |
| 4577 | GEN_ERROR("No arguments passed to a function that " |
| 4578 | "expects arguments!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4579 | } else { // Has arguments? |
| 4580 | // Loop through FunctionType's arguments and ensure they are specified |
| 4581 | // correctly! |
| 4582 | // |
| 4583 | FunctionType::param_iterator I = Ty->param_begin(); |
| 4584 | FunctionType::param_iterator E = Ty->param_end(); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4585 | ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4586 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4587 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 4588 | if (ArgI->Val->getType() != *I) |
| 4589 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4590 | (*I)->getDescription() + "'!"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4591 | Args.push_back(ArgI->Val); |
| 4592 | } |
| 4593 | if (Ty->isVarArg()) { |
| 4594 | if (I == E) |
| 4595 | for (; ArgI != ArgE; ++ArgI) |
| 4596 | Args.push_back(ArgI->Val); // push the remaining varargs |
| 4597 | } else if (I != E || ArgI != ArgE) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4598 | GEN_ERROR("Invalid number of parameters detected!"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4599 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4600 | // Create the call node |
| 4601 | CallInst *CI = new CallInst(V, Args); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4602 | CI->setTailCall(yyvsp[-7].BoolVal); |
| 4603 | CI->setCallingConv(yyvsp[-6].UIntVal); |
| 4604 | yyval.InstVal = CI; |
| 4605 | delete yyvsp[-2].ValueRefList; |
| 4606 | delete yyvsp[-5].TypeVal; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4607 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4608 | ; |
| 4609 | break;} |
| 4610 | case 275: |
| 4611 | #line 2767 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4612 | { |
| 4613 | yyval.InstVal = yyvsp[0].InstVal; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4614 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4615 | ; |
| 4616 | break;} |
| 4617 | case 276: |
| 4618 | #line 2772 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4619 | { |
| 4620 | yyval.BoolVal = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4621 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4622 | ; |
| 4623 | break;} |
| 4624 | case 277: |
| 4625 | #line 2776 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4626 | { |
| 4627 | yyval.BoolVal = false; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4628 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4629 | ; |
| 4630 | break;} |
| 4631 | case 278: |
| 4632 | #line 2783 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4633 | { |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4634 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4635 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 4636 | yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); |
| 4637 | delete yyvsp[-1].TypeVal; |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4638 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4639 | ; |
| 4640 | break;} |
| 4641 | case 279: |
| 4642 | #line 2790 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4643 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4644 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4645 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); |
| 4646 | Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4647 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4648 | yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); |
| 4649 | delete yyvsp[-4].TypeVal; |
| 4650 | ; |
| 4651 | break;} |
| 4652 | case 280: |
| 4653 | #line 2798 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4654 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4655 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4656 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 4657 | yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); |
| 4658 | delete yyvsp[-1].TypeVal; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4659 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4660 | ; |
| 4661 | break;} |
| 4662 | case 281: |
| 4663 | #line 2805 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4664 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4665 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4666 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); |
| 4667 | Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4668 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4669 | yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); |
| 4670 | delete yyvsp[-4].TypeVal; |
| 4671 | ; |
| 4672 | break;} |
| 4673 | case 282: |
| 4674 | #line 2813 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4675 | { |
| 4676 | if (!isa<PointerType>(yyvsp[0].ValueVal->getType())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4677 | GEN_ERROR("Trying to free nonpointer type " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4678 | yyvsp[0].ValueVal->getType()->getDescription() + "!"); |
| 4679 | yyval.InstVal = new FreeInst(yyvsp[0].ValueVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4680 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4681 | ; |
| 4682 | break;} |
| 4683 | case 283: |
| 4684 | #line 2821 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4685 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4686 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4687 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 4688 | if (!isa<PointerType>(yyvsp[-1].TypeVal->get())) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4689 | GEN_ERROR("Can't load from nonpointer type: " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4690 | (*yyvsp[-1].TypeVal)->getDescription()); |
| 4691 | if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4692 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4693 | (*yyvsp[-1].TypeVal)->getDescription()); |
| 4694 | Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4695 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4696 | yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal); |
| 4697 | delete yyvsp[-1].TypeVal; |
| 4698 | ; |
| 4699 | break;} |
| 4700 | case 284: |
| 4701 | #line 2835 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4702 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4703 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4704 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); |
| 4705 | const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4706 | if (!PT) |
| 4707 | GEN_ERROR("Can't store to a nonpointer type: " + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4708 | (*yyvsp[-1].TypeVal)->getDescription()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4709 | const Type *ElTy = PT->getElementType(); |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4710 | if (ElTy != yyvsp[-3].ValueVal->getType()) |
| 4711 | GEN_ERROR("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4712 | "' into space of type '" + ElTy->getDescription() + "'!"); |
| 4713 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4714 | Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4715 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4716 | yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, tmpVal, yyvsp[-5].BoolVal); |
| 4717 | delete yyvsp[-1].TypeVal; |
| 4718 | ; |
| 4719 | break;} |
| 4720 | case 285: |
| 4721 | #line 2852 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4722 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4723 | if (!UpRefs.empty()) |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4724 | GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); |
| 4725 | if (!isa<PointerType>(yyvsp[-2].TypeVal->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4726 | GEN_ERROR("getelementptr insn requires pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4727 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4728 | if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4729 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4730 | (*yyvsp[-2].TypeVal)->getDescription()+ "'!"); |
| 4731 | Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4732 | CHECK_FOR_ERROR |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4733 | yyval.InstVal = new GetElementPtrInst(tmpVal, *yyvsp[0].ValueList); |
| 4734 | delete yyvsp[-2].TypeVal; |
| 4735 | delete yyvsp[0].ValueList; |
| 4736 | ; |
| 4737 | break;} |
| 4738 | } |
| 4739 | /* the action file gets copied in in place of this dollarsign */ |
| 4740 | #line 543 "/usr/share/bison.simple" |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4741 | |
| 4742 | yyvsp -= yylen; |
| 4743 | yyssp -= yylen; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4744 | #ifdef YYLSP_NEEDED |
| 4745 | yylsp -= yylen; |
| 4746 | #endif |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4747 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4748 | #if YYDEBUG != 0 |
| 4749 | if (yydebug) |
| 4750 | { |
| 4751 | short *ssp1 = yyss - 1; |
| 4752 | fprintf (stderr, "state stack now"); |
| 4753 | while (ssp1 != yyssp) |
| 4754 | fprintf (stderr, " %d", *++ssp1); |
| 4755 | fprintf (stderr, "\n"); |
| 4756 | } |
| 4757 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4758 | |
| 4759 | *++yyvsp = yyval; |
| 4760 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4761 | #ifdef YYLSP_NEEDED |
| 4762 | yylsp++; |
| 4763 | if (yylen == 0) |
| 4764 | { |
| 4765 | yylsp->first_line = yylloc.first_line; |
| 4766 | yylsp->first_column = yylloc.first_column; |
| 4767 | yylsp->last_line = (yylsp-1)->last_line; |
| 4768 | yylsp->last_column = (yylsp-1)->last_column; |
| 4769 | yylsp->text = 0; |
| 4770 | } |
| 4771 | else |
| 4772 | { |
| 4773 | yylsp->last_line = (yylsp+yylen-1)->last_line; |
| 4774 | yylsp->last_column = (yylsp+yylen-1)->last_column; |
| 4775 | } |
| 4776 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4777 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4778 | /* Now "shift" the result of the reduction. |
| 4779 | Determine what state that goes to, |
| 4780 | based on the state we popped back to |
| 4781 | and the rule number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4782 | |
| 4783 | yyn = yyr1[yyn]; |
| 4784 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4785 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; |
| 4786 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4787 | yystate = yytable[yystate]; |
| 4788 | else |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4789 | yystate = yydefgoto[yyn - YYNTBASE]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4790 | |
| 4791 | goto yynewstate; |
| 4792 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4793 | yyerrlab: /* here on detecting error */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4794 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4795 | if (! yyerrstatus) |
| 4796 | /* If not already recovering from an error, report this error. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4797 | { |
| 4798 | ++yynerrs; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4799 | |
| 4800 | #ifdef YYERROR_VERBOSE |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4801 | yyn = yypact[yystate]; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4802 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4803 | if (yyn > YYFLAG && yyn < YYLAST) |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4804 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4805 | int size = 0; |
| 4806 | char *msg; |
| 4807 | int x, count; |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4808 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4809 | count = 0; |
| 4810 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ |
| 4811 | for (x = (yyn < 0 ? -yyn : 0); |
| 4812 | x < (sizeof(yytname) / sizeof(char *)); x++) |
| 4813 | if (yycheck[x + yyn] == x) |
| 4814 | size += strlen(yytname[x]) + 15, count++; |
| 4815 | msg = (char *) malloc(size + 15); |
| 4816 | if (msg != 0) |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4817 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4818 | strcpy(msg, "parse error"); |
| 4819 | |
| 4820 | if (count < 5) |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4821 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4822 | count = 0; |
| 4823 | for (x = (yyn < 0 ? -yyn : 0); |
| 4824 | x < (sizeof(yytname) / sizeof(char *)); x++) |
| 4825 | if (yycheck[x + yyn] == x) |
| 4826 | { |
| 4827 | strcat(msg, count == 0 ? ", expecting `" : " or `"); |
| 4828 | strcat(msg, yytname[x]); |
| 4829 | strcat(msg, "'"); |
| 4830 | count++; |
| 4831 | } |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4832 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4833 | yyerror(msg); |
| 4834 | free(msg); |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4835 | } |
| 4836 | else |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4837 | yyerror ("parse error; also virtual memory exceeded"); |
Reid Spencer | 5cbf985 | 2007-01-30 20:08:39 +0000 | [diff] [blame] | 4838 | } |
| 4839 | else |
| 4840 | #endif /* YYERROR_VERBOSE */ |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4841 | yyerror("parse error"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4842 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4843 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4844 | goto yyerrlab1; |
| 4845 | yyerrlab1: /* here on error raised explicitly by an action */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4846 | |
| 4847 | if (yyerrstatus == 3) |
| 4848 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4849 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4850 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4851 | /* return failure if at end of input */ |
| 4852 | if (yychar == YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4853 | YYABORT; |
| 4854 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4855 | #if YYDEBUG != 0 |
| 4856 | if (yydebug) |
| 4857 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); |
| 4858 | #endif |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4859 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4860 | yychar = YYEMPTY; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4861 | } |
| 4862 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4863 | /* Else will try to reuse lookahead token |
| 4864 | after shifting the error token. */ |
| 4865 | |
| 4866 | yyerrstatus = 3; /* Each real token shifted decrements this */ |
| 4867 | |
| 4868 | goto yyerrhandle; |
| 4869 | |
| 4870 | yyerrdefault: /* current state does not do anything special for the error token. */ |
| 4871 | |
| 4872 | #if 0 |
| 4873 | /* This is wrong; only states that explicitly want error tokens |
| 4874 | should shift them. */ |
| 4875 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ |
| 4876 | if (yyn) goto yydefault; |
| 4877 | #endif |
| 4878 | |
| 4879 | yyerrpop: /* pop the current state because it cannot handle the error token */ |
| 4880 | |
| 4881 | if (yyssp == yyss) YYABORT; |
| 4882 | yyvsp--; |
| 4883 | yystate = *--yyssp; |
| 4884 | #ifdef YYLSP_NEEDED |
| 4885 | yylsp--; |
| 4886 | #endif |
| 4887 | |
| 4888 | #if YYDEBUG != 0 |
| 4889 | if (yydebug) |
| 4890 | { |
| 4891 | short *ssp1 = yyss - 1; |
| 4892 | fprintf (stderr, "Error: state stack now"); |
| 4893 | while (ssp1 != yyssp) |
| 4894 | fprintf (stderr, " %d", *++ssp1); |
| 4895 | fprintf (stderr, "\n"); |
| 4896 | } |
| 4897 | #endif |
| 4898 | |
| 4899 | yyerrhandle: |
| 4900 | |
| 4901 | yyn = yypact[yystate]; |
| 4902 | if (yyn == YYFLAG) |
| 4903 | goto yyerrdefault; |
| 4904 | |
| 4905 | yyn += YYTERROR; |
| 4906 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) |
| 4907 | goto yyerrdefault; |
| 4908 | |
| 4909 | yyn = yytable[yyn]; |
| 4910 | if (yyn < 0) |
| 4911 | { |
| 4912 | if (yyn == YYFLAG) |
| 4913 | goto yyerrpop; |
| 4914 | yyn = -yyn; |
| 4915 | goto yyreduce; |
| 4916 | } |
| 4917 | else if (yyn == 0) |
| 4918 | goto yyerrpop; |
| 4919 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4920 | if (yyn == YYFINAL) |
| 4921 | YYACCEPT; |
| 4922 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4923 | #if YYDEBUG != 0 |
| 4924 | if (yydebug) |
| 4925 | fprintf(stderr, "Shifting error token, "); |
| 4926 | #endif |
| 4927 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4928 | *++yyvsp = yylval; |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4929 | #ifdef YYLSP_NEEDED |
| 4930 | *++yylsp = yylloc; |
| 4931 | #endif |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4932 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4933 | yystate = yyn; |
| 4934 | goto yynewstate; |
| 4935 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4936 | yyacceptlab: |
| 4937 | /* YYACCEPT comes here. */ |
| 4938 | if (yyfree_stacks) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4939 | { |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4940 | free (yyss); |
| 4941 | free (yyvs); |
| 4942 | #ifdef YYLSP_NEEDED |
| 4943 | free (yyls); |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 4944 | #endif |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4945 | } |
| 4946 | return 0; |
| 4947 | |
| 4948 | yyabortlab: |
| 4949 | /* YYABORT comes here. */ |
| 4950 | if (yyfree_stacks) |
| 4951 | { |
| 4952 | free (yyss); |
| 4953 | free (yyvs); |
| 4954 | #ifdef YYLSP_NEEDED |
| 4955 | free (yyls); |
| 4956 | #endif |
| 4957 | } |
| 4958 | return 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4959 | } |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame^] | 4960 | #line 2869 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4961 | |
| 4962 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4963 | // common code from the two 'RunVMAsmParser' functions |
| 4964 | static Module* RunParser(Module * M) { |
| 4965 | |
| 4966 | llvmAsmlineno = 1; // Reset the current line number... |
| 4967 | CurModule.CurrentModule = M; |
| 4968 | #if YYDEBUG |
| 4969 | yydebug = Debug; |
| 4970 | #endif |
| 4971 | |
| 4972 | // Check to make sure the parser succeeded |
| 4973 | if (yyparse()) { |
| 4974 | if (ParserResult) |
| 4975 | delete ParserResult; |
| 4976 | return 0; |
| 4977 | } |
| 4978 | |
| 4979 | // Check to make sure that parsing produced a result |
| 4980 | if (!ParserResult) |
| 4981 | return 0; |
| 4982 | |
| 4983 | // Reset ParserResult variable while saving its value for the result. |
| 4984 | Module *Result = ParserResult; |
| 4985 | ParserResult = 0; |
| 4986 | |
| 4987 | return Result; |
| 4988 | } |
| 4989 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4990 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 4991 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 4992 | // TODO: column number in exception |
| 4993 | if (TheParseError) |
| 4994 | TheParseError->setError(CurFilename, message, LineNo); |
| 4995 | TriggerError = 1; |
| 4996 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4997 | |
| 4998 | int yyerror(const char *ErrorMsg) { |
| 4999 | std::string where |
| 5000 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5001 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5002 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5003 | if (yychar == YYEMPTY || yychar == 0) |
| 5004 | errMsg += "end-of-file."; |
| 5005 | else |
| 5006 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5007 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5008 | return 0; |
| 5009 | } |