Mercurial > projects > ldc
comparison gen/classes.cpp @ 1534:8ca25bd765a3
Build fix for the latest LLVMContext changes (LLVM r75445)
This shouldn't break the build with older LLVM revs. We include
LLVMContext.h in gen/llvm.h now to make the transition a little bit
easier.
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Mon, 13 Jul 2009 12:17:58 +0200 |
parents | 2292878925f4 |
children | 61f12f4651b5 |
comparison
equal
deleted
inserted
replaced
1533:d1652c8fb4f6 | 1534:8ca25bd765a3 |
---|---|
209 LLValue* val = DtoBitCast(tc->sym->ir.irStruct->getVtblSymbol(), tmp->getType()->getContainedType(0)); | 209 LLValue* val = DtoBitCast(tc->sym->ir.irStruct->getVtblSymbol(), tmp->getType()->getContainedType(0)); |
210 DtoStore(val, tmp); | 210 DtoStore(val, tmp); |
211 | 211 |
212 // monitor always defaults to zero | 212 // monitor always defaults to zero |
213 tmp = DtoGEPi(dst,0,1,"monitor"); | 213 tmp = DtoGEPi(dst,0,1,"monitor"); |
214 val = llvm::Constant::getNullValue(tmp->getType()->getContainedType(0)); | 214 val = llvm::getGlobalContext().getNullValue(tmp->getType()->getContainedType(0)); |
215 DtoStore(val, tmp); | 215 DtoStore(val, tmp); |
216 | 216 |
217 // done? | 217 // done? |
218 if (n == 0) | 218 if (n == 0) |
219 return; | 219 return; |
260 } | 260 } |
261 // class -> bool | 261 // class -> bool |
262 else if (to->ty == Tbool) { | 262 else if (to->ty == Tbool) { |
263 IF_LOG Logger::println("to bool"); | 263 IF_LOG Logger::println("to bool"); |
264 LLValue* llval = val->getRVal(); | 264 LLValue* llval = val->getRVal(); |
265 LLValue* zero = LLConstant::getNullValue(llval->getType()); | 265 LLValue* zero = llvm::getGlobalContext().getNullValue(llval->getType()); |
266 return new DImValue(_to, gIR->ir->CreateICmpNE(llval, zero, "tmp")); | 266 return new DImValue(_to, gIR->ir->CreateICmpNE(llval, zero, "tmp")); |
267 } | 267 } |
268 // class -> integer | 268 // class -> integer |
269 else if (to->isintegral()) { | 269 else if (to->isintegral()) { |
270 IF_LOG Logger::println("to %s", to->toChars()); | 270 IF_LOG Logger::println("to %s", to->toChars()); |
324 | 324 |
325 // Check whether the original value was null, and return null if so. | 325 // Check whether the original value was null, and return null if so. |
326 // Sure we could have jumped over the code above in this case, but | 326 // Sure we could have jumped over the code above in this case, but |
327 // it's just a GEP and (maybe) a pointer-to-pointer BitCast, so it | 327 // it's just a GEP and (maybe) a pointer-to-pointer BitCast, so it |
328 // should be pretty cheap and perfectly safe even if the original was null. | 328 // should be pretty cheap and perfectly safe even if the original was null. |
329 LLValue* isNull = gIR->ir->CreateICmpEQ(orig, LLConstant::getNullValue(orig->getType()), ".nullcheck"); | 329 LLValue* isNull = gIR->ir->CreateICmpEQ(orig, llvm::getGlobalContext().getNullValue(orig->getType()), ".nullcheck"); |
330 v = gIR->ir->CreateSelect(isNull, LLConstant::getNullValue(ifType), v, ".interface"); | 330 v = gIR->ir->CreateSelect(isNull, llvm::getGlobalContext().getNullValue(ifType), v, ".interface"); |
331 | 331 |
332 // return r-value | 332 // return r-value |
333 return new DImValue(_to, v); | 333 return new DImValue(_to, v); |
334 } | 334 } |
335 // class -> interface | 335 // class -> interface |
600 | 600 |
601 LLConstant* size = DtoConstSize_t(nvars); | 601 LLConstant* size = DtoConstSize_t(nvars); |
602 LLConstant* ptr; | 602 LLConstant* ptr; |
603 | 603 |
604 if (nvars == 0) | 604 if (nvars == 0) |
605 return LLConstant::getNullValue( arrayT ); | 605 return llvm::getGlobalContext().getNullValue( arrayT ); |
606 | 606 |
607 // array type | 607 // array type |
608 const llvm::ArrayType* arrTy = llvm::ArrayType::get(arrayInits[0]->getType(), nvars); | 608 const llvm::ArrayType* arrTy = llvm::ArrayType::get(arrayInits[0]->getType(), nvars); |
609 LLConstant* arrInit = llvm::ConstantArray::get(arrTy, arrayInits); | 609 LLConstant* arrInit = llvm::ConstantArray::get(arrTy, arrayInits); |
610 | 610 |