Mercurial > projects > ldc
comparison gen/nested.cpp @ 1350:15e9762bb620
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 .
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Thu, 14 May 2009 13:26:40 +0200 |
parents | 919fafcc505c |
children | 630fc54f7c1e |
comparison
equal
deleted
inserted
replaced
1349:a376776e2301 | 1350:15e9762bb620 |
---|---|
165 LLValue* nestedVar = irfunc->nestedVar; | 165 LLValue* nestedVar = irfunc->nestedVar; |
166 | 166 |
167 if (nestedCtx == NCArray) { | 167 if (nestedCtx == NCArray) { |
168 // alloca as usual if no value already | 168 // alloca as usual if no value already |
169 if (!vd->ir.irLocal->value) | 169 if (!vd->ir.irLocal->value) |
170 vd->ir.irLocal->value = DtoAlloca(DtoType(vd->type), vd->toChars()); | 170 vd->ir.irLocal->value = DtoAlloca(vd->type, vd->toChars()); |
171 | 171 |
172 // store the address into the nested vars array | 172 // store the address into the nested vars array |
173 assert(vd->ir.irLocal->nestedIndex >= 0); | 173 assert(vd->ir.irLocal->nestedIndex >= 0); |
174 LLValue* gep = DtoGEPi(nestedVar, 0, vd->ir.irLocal->nestedIndex); | 174 LLValue* gep = DtoGEPi(nestedVar, 0, vd->ir.irLocal->nestedIndex); |
175 | 175 |
322 | 322 |
323 // make array type for nested vars | 323 // make array type for nested vars |
324 const LLType* nestedVarsTy = LLArrayType::get(getVoidPtrType(), nelems); | 324 const LLType* nestedVarsTy = LLArrayType::get(getVoidPtrType(), nelems); |
325 | 325 |
326 // alloca it | 326 // alloca it |
327 LLValue* nestedVars = DtoAlloca(nestedVarsTy, ".nested_vars"); | 327 // FIXME align ? |
328 LLValue* nestedVars = DtoRawAlloca(nestedVarsTy, 0, ".nested_vars"); | |
328 | 329 |
329 IrFunction* irfunction = fd->ir.irFunc; | 330 IrFunction* irfunction = fd->ir.irFunc; |
330 | 331 |
331 // copy parent frame into beginning | 332 // copy parent frame into beginning |
332 if (nparelems) | 333 if (nparelems) |
457 | 458 |
458 // Create frame for current function and append to frames list | 459 // Create frame for current function and append to frames list |
459 // FIXME: For D2, this should be a gc_malloc (or similar) call, not alloca | 460 // FIXME: For D2, this should be a gc_malloc (or similar) call, not alloca |
460 // (Note that it'd also require more aggressive copying of | 461 // (Note that it'd also require more aggressive copying of |
461 // by-value parameters instead of just alloca'd ones) | 462 // by-value parameters instead of just alloca'd ones) |
462 LLValue* frame = DtoAlloca(frameType, ".frame"); | 463 // FIXME: alignment ? |
464 LLValue* frame = DtoRawAlloca(frameType, 0, ".frame"); | |
463 | 465 |
464 // copy parent frames into beginning | 466 // copy parent frames into beginning |
465 if (depth != 0) { | 467 if (depth != 0) { |
466 LLValue* src = irfunction->nestArg; | 468 LLValue* src = irfunction->nestArg; |
467 if (!src) { | 469 if (!src) { |