Mercurial > projects > ldc
diff gen/arrays.cpp @ 479:672eb4893b55
Move AllocaInst creation into DtoAlloca helper. Will enable special zero-init of fp80 reals' padding.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 05 Aug 2008 19:28:19 +0200 |
parents | 76078c8ab5b9 |
children | a34078905d01 |
line wrap: on
line diff
--- a/gen/arrays.cpp Tue Aug 05 08:08:00 2008 +0200 +++ b/gen/arrays.cpp Tue Aug 05 19:28:19 2008 +0200 @@ -118,7 +118,7 @@ // give slices and complex values storage (and thus an address to pass) if (value->isSlice() || value->isComplex()) { - val = new llvm::AllocaInst(DtoType(value->getType()), ".tmpparam", gIR->topallocapoint()); + val = DtoAlloca(DtoType(value->getType()), ".tmpparam"); DVarValue lval(value->getType(), val, true); DtoAssign(loc, &lval, value); } @@ -445,7 +445,7 @@ LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, zeroInit ? "_d_newarraymT" : "_d_newarraymiT" ); // build dims - LLValue* dimsArg = new llvm::AllocaInst(DtoSize_t(), DtoConstUint(ndims), ".newdims", gIR->topallocapoint()); + LLValue* dimsArg = DtoAlloca(DtoSize_t(), DtoConstUint(ndims), ".newdims"); LLValue* firstDim = NULL; for (size_t i=0; i<ndims; ++i) { @@ -698,13 +698,13 @@ // we need to give slices storage if (l->isSlice()) { - lmem = new llvm::AllocaInst(DtoType(l->getType()), "tmpparam", gIR->topallocapoint()); + lmem = DtoAlloca(DtoType(l->getType()), "tmpparam"); DtoSetArray(lmem, DtoArrayLen(l), DtoArrayPtr(l)); } // also null else if (l->isNull()) { - lmem = new llvm::AllocaInst(DtoType(l->getType()), "tmpparam", gIR->topallocapoint()); + lmem = DtoAlloca(DtoType(l->getType()), "tmpparam"); DtoSetArray(lmem, llvm::Constant::getNullValue(DtoSize_t()), llvm::Constant::getNullValue(DtoType(l->getType()->next->pointerTo()))); } else @@ -713,13 +713,13 @@ // and for the rvalue ... // we need to give slices storage if (r->isSlice()) { - rmem = new llvm::AllocaInst(DtoType(r->getType()), "tmpparam", gIR->topallocapoint()); + rmem = DtoAlloca(DtoType(r->getType()), "tmpparam"); DtoSetArray(rmem, DtoArrayLen(r), DtoArrayPtr(r)); } // also null else if (r->isNull()) { - rmem = new llvm::AllocaInst(DtoType(r->getType()), "tmpparam", gIR->topallocapoint()); + rmem = DtoAlloca(DtoType(r->getType()), "tmpparam"); DtoSetArray(rmem, llvm::Constant::getNullValue(DtoSize_t()), llvm::Constant::getNullValue(DtoType(r->getType()->next->pointerTo()))); } else @@ -1078,7 +1078,7 @@ llvm::AllocaInst* alloc = gIR->func()->srcfileArg; if (!alloc) { - alloc = new llvm::AllocaInst(c->getType(), ".srcfile", gIR->topallocapoint()); + alloc = DtoAlloca(c->getType(), ".srcfile"); gIR->func()->srcfileArg = alloc; } LLValue* ptr = DtoGEPi(alloc, 0,0, "tmp");