Use posix_memalign to allocate 16 byte alligned memeory on Linux/MacOS.

This commit is contained in:
Dmitry Babokin
2013-04-26 20:33:24 +04:00
parent d36ab4cc3c
commit 95950885cf
6 changed files with 77 additions and 14 deletions

View File

@@ -8214,16 +8214,24 @@ NewExpr::GetValue(FunctionEmitContext *ctx) const {
// varying, and taking 32-bit or 64-bit allocation counts.
llvm::Function *func;
if (isVarying) {
if (do32Bit)
func = m->module->getFunction("__new_varying32");
else
func = m->module->getFunction("__new_varying64");
if (g->target->is32Bit()) {
func = m->module->getFunction("__new_varying32_32rt");
} else if (g->opt.force32BitAddressing) {
func = m->module->getFunction("__new_varying32_64rt");
} else {
func = m->module->getFunction("__new_varying64_64rt");
}
}
else {
// FIXME: __new_uniform_32rt should take i32
if (allocSize->getType() != LLVMTypes::Int64Type)
allocSize = ctx->SExtInst(allocSize, LLVMTypes::Int64Type,
"alloc_size64");
func = m->module->getFunction("__new_uniform");
if (g->target->is32Bit()) {
func = m->module->getFunction("__new_uniform_32rt");
} else {
func = m->module->getFunction("__new_uniform_64rt");
}
}
AssertPos(pos, func != NULL);