Mercurial > projects > ldc
changeset 460:3a5d6ff8c70f
Automated merge with http://hg.dsource.org/projects/llvmdc
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 02 Aug 2008 22:54:46 +0200 |
parents | 121624c14053 (diff) 9db9099583ca (current diff) |
children | 2b28fd92bab8 e381e082d5cb |
files | gen/toir.cpp |
diffstat | 4 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/aa.cpp Sat Aug 02 22:54:36 2008 +0200 +++ b/gen/aa.cpp Sat Aug 02 22:54:46 2008 +0200 @@ -66,17 +66,19 @@ ///////////////////////////////////////////////////////////////////////////////////// -DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key) +DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key, bool lvalue) { // call: - // extern(C) void* _aaGet(AA* aa, TypeInfo keyti, void* pkey, size_t valuesize) + // extern(C) void* _aaGet(AA* aa, TypeInfo keyti, size_t valuesize, void* pkey) + // or + // extern(C) void* _aaGetRvalue(AA aa, TypeInfo keyti, size_t valuesize, void* pkey) // first get the runtime function - llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_aaGet"); + llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, lvalue?"_aaGet":"_aaGetRvalue"); const llvm::FunctionType* funcTy = func->getFunctionType(); // aa param - LLValue* aaval = aa->getLVal(); + LLValue* aaval = lvalue ? aa->getLVal() : aa->getRVal(); aaval = DtoBitCast(aaval, funcTy->getParamType(0)); // keyti param
--- a/gen/aa.h Sat Aug 02 22:54:36 2008 +0200 +++ b/gen/aa.h Sat Aug 02 22:54:46 2008 +0200 @@ -1,7 +1,7 @@ #ifndef LLVMDC_GEN_AA_H #define LLVMDC_GEN_AA_H -DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key); +DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key, bool lvalue); DValue* DtoAAIn(Loc& loc, Type* type, DValue* aa, DValue* key); void DtoAARemove(Loc& loc, DValue* aa, DValue* key);
--- a/gen/functions.cpp Sat Aug 02 22:54:36 2008 +0200 +++ b/gen/functions.cpp Sat Aug 02 22:54:46 2008 +0200 @@ -595,8 +595,10 @@ VarDeclaration* vd = argsym->isVarDeclaration(); assert(vd); + bool refoutlazy = vd->storage_class & (STCref | STCout | STClazy); + // FIXME: llvm seems to want an alloca/byval for debug info - if (!vd->needsStorage || vd->nestedref || vd->isRef() || vd->isOut()) + if (!vd->needsStorage || vd->nestedref || refoutlazy) { Logger::println("skipping arg storage for (%s) %s ", vd->loc.toChars(), vd->toChars()); continue;
--- a/gen/toir.cpp Sat Aug 02 22:54:36 2008 +0200 +++ b/gen/toir.cpp Sat Aug 02 22:54:46 2008 +0200 @@ -1045,7 +1045,7 @@ arrptr = DtoGEP1(arrptr,r->getRVal()); } else if (e1type->ty == Taarray) { - return DtoAAIndex(loc, type, l, r); + return DtoAAIndex(loc, type, l, r, modifiable); } else { Logger::println("invalid index exp! e1type: %s", e1type->toChars()); @@ -2266,7 +2266,7 @@ // index DValue* key = ekey->toElem(p); - DValue* mem = DtoAAIndex(loc, vtype, aa, key); + DValue* mem = DtoAAIndex(loc, vtype, aa, key, true); // store DValue* val = eval->toElem(p);