Mercurial > projects > ldc
diff gen/toir.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 | a41a40deff73 |
children | 8d501abecd24 |
line wrap: on
line diff
--- a/gen/toir.cpp Wed May 13 18:08:40 2009 +0200 +++ b/gen/toir.cpp Thu May 14 13:26:40 2009 +0200 @@ -909,7 +909,7 @@ { assert(v->isSlice()); LLValue* rval = v->getRVal(); - lval = DtoAlloca(rval->getType(), ".tmp_slice_storage"); + lval = DtoRawAlloca(rval->getType(), 0, ".tmp_slice_storage"); DtoStore(rval, lval); } @@ -2124,13 +2124,12 @@ LOG_SCOPE; Type* dtype = type->toBasetype(); - const LLType* resty = DtoType(dtype); DValue* dvv; // voids returns will need no storage if (dtype->ty != Tvoid) { // allocate a temporary for the final result. failed to come up with a better way :/ - LLValue* resval = DtoAlloca(resty,"condtmp"); + LLValue* resval = DtoAlloca(dtype,"condtmp"); dvv = new DVarValue(type, resval); } else { dvv = new DConstValue(type, getNullValue(DtoTypeNotVoid(dtype))); @@ -2345,7 +2344,7 @@ dstMem = dynSlice->ptr; } else - dstMem = DtoAlloca(llStoType, "arrayliteral"); + dstMem = DtoRawAlloca(llStoType, 0, "arrayliteral"); // store elements for (size_t i=0; i<len; ++i) @@ -2509,7 +2508,7 @@ const LLType* st = llvm::StructType::get(valuetypes, packed); // alloca a stack slot - LLValue* mem = DtoAlloca(st, ".structliteral"); + LLValue* mem = DtoRawAlloca(st, 0, ".structliteral"); // fill in values for (size_t i = 0; i < n; i++) @@ -2596,12 +2595,11 @@ Type* aatype = type->toBasetype(); Type* vtype = aatype->nextOf(); - const LLType* aalltype = DtoType(type); // it should be possible to avoid the temporary in some cases - LLValue* tmp = DtoAlloca(aalltype,"aaliteral"); + LLValue* tmp = DtoAlloca(type,"aaliteral"); DValue* aa = new DVarValue(type, tmp); - DtoStore(LLConstant::getNullValue(aalltype), tmp); + DtoStore(LLConstant::getNullValue(DtoType(type)), tmp); const size_t n = keys->dim; for (size_t i=0; i<n; ++i)