Mercurial > projects > ldc
diff gen/llvmhelpers.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 | 45a67b6f1310 |
children | fc12214ba4a1 |
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp Tue Aug 05 08:08:00 2008 +0200 +++ b/gen/llvmhelpers.cpp Tue Aug 05 19:28:19 2008 +0200 @@ -85,6 +85,23 @@ /****************************************************************************************/ /*//////////////////////////////////////////////////////////////////////////////////////// +// ALLOCA HELPERS +////////////////////////////////////////////////////////////////////////////////////////*/ + + +llvm::AllocaInst* DtoAlloca(const LLType* lltype, const std::string& name) +{ + return new llvm::AllocaInst(lltype, name, gIR->topallocapoint()); +} + +llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std::string& name) +{ + return new llvm::AllocaInst(lltype, arraysize, name, gIR->topallocapoint()); +} + + +/****************************************************************************************/ +/*//////////////////////////////////////////////////////////////////////////////////////// // ASSERT HELPER ////////////////////////////////////////////////////////////////////////////////////////*/ @@ -112,7 +129,7 @@ llvm::AllocaInst* alloc = gIR->func()->msgArg; if (!alloc) { - alloc = new llvm::AllocaInst(c->getType(), ".assertmsg", gIR->topallocapoint()); + alloc = DtoAlloca(c->getType(), ".assertmsg"); DtoSetArray(alloc, DtoArrayLen(s), DtoArrayPtr(s)); gIR->func()->msgArg = alloc; } @@ -129,7 +146,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"); @@ -1211,7 +1228,7 @@ if(gTargetData->getTypeSizeInBits(lltype) == 0) allocainst = llvm::ConstantPointerNull::get(getPtrToType(lltype)); else - allocainst = new llvm::AllocaInst(lltype, vd->toChars(), gIR->topallocapoint()); + allocainst = DtoAlloca(lltype, vd->toChars()); //allocainst->setAlignment(vd->type->alignsize()); // TODO vd->ir.irLocal = new IrLocal(vd);