Mercurial > projects > ldc
comparison gen/arrays.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 | 16d9afa22df4 |
children | 229e02867307 |
comparison
equal
deleted
inserted
replaced
1349:a376776e2301 | 1350:15e9762bb620 |
---|---|
75 LLValue* val; | 75 LLValue* val; |
76 | 76 |
77 // give slices and complex values storage (and thus an address to pass) | 77 // give slices and complex values storage (and thus an address to pass) |
78 if (value->isSlice()) | 78 if (value->isSlice()) |
79 { | 79 { |
80 val = DtoAlloca(DtoType(value->getType()), ".tmpparam"); | 80 val = DtoAlloca(value->getType(), ".tmpparam"); |
81 DVarValue lval(value->getType(), val); | 81 DVarValue lval(value->getType(), val); |
82 DtoAssign(loc, &lval, value); | 82 DtoAssign(loc, &lval, value); |
83 } | 83 } |
84 else | 84 else |
85 { | 85 { |
446 bool zeroInit = vtype->isZeroInit(); | 446 bool zeroInit = vtype->isZeroInit(); |
447 const char* fnname = defaultInit ? (zeroInit ? "_d_newarraymT" : "_d_newarraymiT") : "_d_newarraymvT"; | 447 const char* fnname = defaultInit ? (zeroInit ? "_d_newarraymT" : "_d_newarraymiT") : "_d_newarraymvT"; |
448 LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, fnname); | 448 LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, fnname); |
449 | 449 |
450 // build dims | 450 // build dims |
451 LLValue* dimsArg = DtoAlloca(DtoSize_t(), DtoConstUint(ndims), ".newdims"); | 451 LLValue* dimsArg = DtoArrayAlloca(Type::tsize_t, ndims, ".newdims"); |
452 LLValue* firstDim = NULL; | 452 LLValue* firstDim = NULL; |
453 for (size_t i=0; i<ndims; ++i) | 453 for (size_t i=0; i<ndims; ++i) |
454 { | 454 { |
455 LLValue* dim = dims[i]->getRVal(); | 455 LLValue* dim = dims[i]->getRVal(); |
456 if (!firstDim) firstDim = dim; | 456 if (!firstDim) firstDim = dim; |