mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-05 06:23:13 +01:00
Implemented CommaExp::cacheLvalue(). Fixed CallExp::chackLvalue().
This commit is contained in:
@@ -1122,10 +1122,8 @@ struct CallExp : UnaExp
|
||||
|
||||
#if IN_LLVM
|
||||
DValue* toElem(IRState* irs);
|
||||
#if DMDV2
|
||||
void cacheLvalue(IRState* p);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
struct AddrExp : UnaExp
|
||||
@@ -1415,6 +1413,7 @@ struct CommaExp : BinExp
|
||||
|
||||
#if IN_LLVM
|
||||
DValue* toElem(IRState* irs);
|
||||
void cacheLvalue(IRState* irs);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
31
gen/toir.cpp
31
gen/toir.cpp
@@ -52,14 +52,6 @@ llvm::cl::opt<bool> checkPrintf("check-printf-calls",
|
||||
|
||||
void Expression::cacheLvalue(IRState* irs)
|
||||
{
|
||||
#if DMDV2
|
||||
if (isLvalue()) {
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = toElem(irs)->getLVal();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
error("expression %s does not mask any l-value", toChars());
|
||||
fatal();
|
||||
}
|
||||
@@ -786,8 +778,6 @@ DValue* ModExp::toElem(IRState* p)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if DMDV2
|
||||
|
||||
void CallExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
|
||||
@@ -796,8 +786,6 @@ void CallExp::cacheLvalue(IRState* p)
|
||||
cachedLvalue = toElem(p)->getLVal();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DValue* CallExp::toElem(IRState* p)
|
||||
@@ -805,6 +793,12 @@ DValue* CallExp::toElem(IRState* p)
|
||||
Logger::print("CallExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (cachedLvalue)
|
||||
{
|
||||
LLValue* V = cachedLvalue;
|
||||
return new DVarValue(type, V);
|
||||
}
|
||||
|
||||
// handle magic inline asm
|
||||
if (e1->op == TOKvar)
|
||||
{
|
||||
@@ -2229,12 +2223,25 @@ DValue* CommaExp::toElem(IRState* p)
|
||||
Logger::print("CommaExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (cachedLvalue)
|
||||
{
|
||||
LLValue* V = cachedLvalue;
|
||||
return new DVarValue(type, V);
|
||||
}
|
||||
|
||||
DValue* u = e1->toElem(p);
|
||||
DValue* v = e2->toElem(p);
|
||||
assert(e2->type == type);
|
||||
return v;
|
||||
}
|
||||
|
||||
void CommaExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = toElem(p)->getLVal();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DValue* CondExp::toElem(IRState* p)
|
||||
|
||||
@@ -88,7 +88,7 @@ void IrFuncTy::getParam(Type* dty, int idx, DValue* val, llvm::Value* lval)
|
||||
|
||||
LLValue *rval = val->getRVal();
|
||||
#if DMDV2
|
||||
if (DtoIsPassedByRef(val->type))
|
||||
if (DtoIsPassedByRef(val->type) && isaPointer(rval))
|
||||
rval = DtoLoad(rval);
|
||||
#endif
|
||||
DtoStore(rval, lval);
|
||||
|
||||
13
phobos.patch
13
phobos.patch
@@ -1,14 +1,3 @@
|
||||
diff -U 3 -H -d -r -N -x '*.mak' -x tk -x backend -x debug -x release -x '*_pch.h' -x Makefile -x '*.rej' -x '*~' -x '*.log' -x .svn -x '*pro.user' -x .directory -x cmake_install -x CMakeFiles -x .preprocessed.tmp -x 'Makefile.*' -x '*.orig' -- phobos-orig/std/base64.d phobos/std/base64.d
|
||||
--- phobos-orig/std/base64.d 2010-12-20 23:02:36.000000000 +0300
|
||||
+++ phobos/std/base64.d 2011-01-06 12:56:56.420864296 +0300
|
||||
@@ -1577,6 +1577,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ version (LDC) {} // FIXME:
|
||||
{ // Encoder and Decoder for single character encoding and decoding
|
||||
alias Base64Impl!('+', '/', Base64.NoPadding) Base64NoPadding;
|
||||
|
||||
diff -U 3 -H -d -r -N -x '*.mak' -x tk -x backend -x debug -x release -x '*_pch.h' -x Makefile -x '*.rej' -x '*~' -x '*.log' -x .svn -x '*pro.user' -x .directory -x cmake_install -x CMakeFiles -x .preprocessed.tmp -x 'Makefile.*' -x '*.orig' -- phobos-orig/std/concurrency.d phobos/std/concurrency.d
|
||||
--- phobos-orig/std/concurrency.d 2010-12-20 23:02:36.000000000 +0300
|
||||
+++ phobos/std/concurrency.d 2011-01-05 15:15:31.000000000 +0300
|
||||
@@ -50,7 +39,7 @@ diff -U 3 -H -d -r -N -x '*.mak' -x tk -x backend -x debug -x release -x '*_pch.
|
||||
return to!T(buffer[0 .. len].dup);
|
||||
diff -U 3 -H -d -r -N -x '*.mak' -x tk -x backend -x debug -x release -x '*_pch.h' -x Makefile -x '*.rej' -x '*~' -x '*.log' -x .svn -x '*pro.user' -x .directory -x cmake_install -x CMakeFiles -x .preprocessed.tmp -x 'Makefile.*' -x '*.orig' -- phobos-orig/std/functional.d phobos/std/functional.d
|
||||
--- phobos-orig/std/functional.d 2010-12-20 23:02:36.000000000 +0300
|
||||
+++ phobos/std/functional.d 2011-01-05 15:15:31.000000000 +0300
|
||||
+++ phobos/std/functional.d 2011-01-06 19:41:23.740864295 +0300
|
||||
@@ -714,6 +714,13 @@
|
||||
assert(dg_pure_nothrow() == 7);
|
||||
//assert(dg_pure_nothrow_safe() == 8);
|
||||
|
||||
Reference in New Issue
Block a user