Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 .

This commit is contained in:
Tomas Lindquist Olsen
2009-05-14 13:26:40 +02:00
parent 5694ec18ff
commit f5d635dfc7
16 changed files with 61 additions and 44 deletions

View File

@@ -167,7 +167,7 @@ void DtoNestedInit(VarDeclaration* vd)
if (nestedCtx == NCArray) {
// alloca as usual if no value already
if (!vd->ir.irLocal->value)
vd->ir.irLocal->value = DtoAlloca(DtoType(vd->type), vd->toChars());
vd->ir.irLocal->value = DtoAlloca(vd->type, vd->toChars());
// store the address into the nested vars array
assert(vd->ir.irLocal->nestedIndex >= 0);
@@ -324,7 +324,8 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
const LLType* nestedVarsTy = LLArrayType::get(getVoidPtrType(), nelems);
// alloca it
LLValue* nestedVars = DtoAlloca(nestedVarsTy, ".nested_vars");
// FIXME align ?
LLValue* nestedVars = DtoRawAlloca(nestedVarsTy, 0, ".nested_vars");
IrFunction* irfunction = fd->ir.irFunc;
@@ -459,7 +460,8 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
// FIXME: For D2, this should be a gc_malloc (or similar) call, not alloca
// (Note that it'd also require more aggressive copying of
// by-value parameters instead of just alloca'd ones)
LLValue* frame = DtoAlloca(frameType, ".frame");
// FIXME: alignment ?
LLValue* frame = DtoRawAlloca(frameType, 0, ".frame");
// copy parent frames into beginning
if (depth != 0) {