From 8968103b8b71b2576c1c290589a903cee4623aab Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 21 Sep 2012 18:54:23 +0200 Subject: [PATCH] Some verbose logging output prettification. --- gen/llvmhelpers.cpp | 22 +++++++++++++++------- gen/toir.cpp | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 26536bab..73e84d29 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -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); diff --git a/gen/toir.cpp b/gen/toir.cpp index d5503094..60f6ec7a 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -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(to->toBasetype()); assert(type->ty == Tvector);