Mercurial > projects > ldc
diff gen/tollvm.cpp @ 1480:b3ba2c6ff038
Use `llvm.memset` instead of `_d_array_init_i1` and `_d_array_init_i8`.
This exposes what's happening to LLVM, and memset is probably faster than the
runtime functions we were using anyway.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 07 Jun 2009 13:57:59 +0200 |
parents | 83bdf7bed9c5 |
children | d9c5f5a43403 |
line wrap: on
line diff
--- a/gen/tollvm.cpp Sat Jun 06 20:16:13 2009 +0200 +++ b/gen/tollvm.cpp Sun Jun 07 13:57:59 2009 +0200 @@ -411,7 +411,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// -void DtoMemSetZero(LLValue* dst, LLValue* nbytes) +void DtoMemSet(LLValue* dst, LLValue* val, LLValue* nbytes) { dst = DtoBitCast(dst,getVoidPtrType()); @@ -419,7 +419,14 @@ llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module, llvm::Intrinsic::memset, &intTy, 1); - gIR->ir->CreateCall4(fn, dst, DtoConstUbyte(0), nbytes, DtoConstUint(0), ""); + gIR->ir->CreateCall4(fn, dst, val, nbytes, DtoConstUint(0), ""); +} + +////////////////////////////////////////////////////////////////////////////////////////// + +void DtoMemSetZero(LLValue* dst, LLValue* nbytes) +{ + DtoMemSet(dst, DtoConstUbyte(0), nbytes); } //////////////////////////////////////////////////////////////////////////////////////////