Some verbose logging output prettification.

This commit is contained in:
David Nadlinger
2012-09-21 18:54:23 +02:00
parent 754cf3805f
commit 8968103b8b
2 changed files with 17 additions and 7 deletions

View File

@@ -390,7 +390,7 @@ void DtoLeaveMonitor(LLValue* v)
void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op)
{
Logger::println("DtoAssign(...);\n");
Logger::println("DtoAssign()");
LOG_SCOPE;
Type* t = lhs->getType()->toBasetype();
@@ -465,8 +465,10 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op)
else if (t->ty == Tdelegate) {
LLValue* l = lhs->getLVal();
LLValue* r = rhs->getRVal();
if (Logger::enabled())
Logger::cout() << "assign\nlhs: " << *l << "rhs: " << *r << '\n';
if (Logger::enabled()) {
Logger::cout() << "lhs: " << *l << '\n';
Logger::cout() << "rhs: " << *r << '\n';
}
DtoStore(r, l);
}
else if (t->ty == Tclass) {
@@ -489,13 +491,19 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op)
else {
LLValue* l = lhs->getLVal();
LLValue* r = rhs->getRVal();
if (Logger::enabled())
Logger::cout() << "assign\nlhs: " << *l << "rhs: " << *r << '\n';
if (Logger::enabled()) {
Logger::cout() << "lhs: " << *l << '\n';
Logger::cout() << "rhs: " << *r << '\n';
}
LLType* lit = l->getType()->getContainedType(0);
if (r->getType() != lit) {
r = DtoCast(loc, rhs, lhs->getType())->getRVal();
if (Logger::enabled())
Logger::cout() << "really assign\nlhs: " << *l << "rhs: " << *r << '\n';
if (Logger::enabled()) {
Logger::println("Type mismatch, really assigning:");
LOG_SCOPE
Logger::cout() << "lhs: " << *l << '\n';
Logger::cout() << "rhs: " << *r << '\n';
}
#if 1
if(r->getType() != lit) // It's wierd but it happens. TODO: try to remove this hack
r = DtoBitCast(r, lit);

View File

@@ -593,6 +593,7 @@ DValue* AssignExp::toElem(IRState* p)
VarExp* ve = (VarExp*)e1;
if (ve->var->storage_class & STCref)
{
Logger::println("performing ref variable initialization");
// Note that the variable value is accessed directly (instead
// of via getLValue(), which would perform a load from the
// uninitialized location), and that rhs is stored as an l-value!
@@ -3221,6 +3222,7 @@ DValue* TupleExp::toElem(IRState *p)
DValue* VectorExp::toElem(IRState* p)
{
Logger::print("VectorExp::toElem() %s\n", toChars());
LOG_SCOPE;
TypeVector *type = static_cast<TypeVector*>(to->toBasetype());
assert(type->ty == Tvector);