comparison gen/statements.cpp @ 622:26fce59fe80a

Wrapped all the most potentially expensive logging calls in a conditional to only do work when actually requested. Commented some logging calls that could potentially write out many megabytes of type dumps.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 01 Oct 2008 18:32:31 +0200
parents 83ca663ecc20
children df196c8dea26
comparison
equal deleted inserted replaced
619:722630261d62 622:26fce59fe80a
77 else { 77 else {
78 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); 78 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum);
79 DValue* e = exp->toElem(p); 79 DValue* e = exp->toElem(p);
80 LLValue* v = e->getRVal(); 80 LLValue* v = e->getRVal();
81 delete e; 81 delete e;
82 Logger::cout() << "return value is '" <<*v << "'\n"; 82
83 if (Logger::enabled())
84 Logger::cout() << "return value is '" <<*v << "'\n";
83 85
84 // can happen for classes 86 // can happen for classes
85 if (v->getType() != p->topfunc()->getReturnType()) 87 if (v->getType() != p->topfunc()->getReturnType())
86 { 88 {
87 v = gIR->ir->CreateBitCast(v, p->topfunc()->getReturnType(), "tmp"); 89 v = gIR->ir->CreateBitCast(v, p->topfunc()->getReturnType(), "tmp");
88 Logger::cout() << "return value after cast: " << *v << '\n'; 90 if (Logger::enabled())
91 Logger::cout() << "return value after cast: " << *v << '\n';
89 } 92 }
90 93
91 DtoEnclosingHandlers(enclosinghandler, NULL); 94 DtoEnclosingHandlers(enclosinghandler, NULL);
92 95
93 if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl); 96 if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl);
163 llvm::BasicBlock* ifbb = llvm::BasicBlock::Create("if", gIR->topfunc(), oldend); 166 llvm::BasicBlock* ifbb = llvm::BasicBlock::Create("if", gIR->topfunc(), oldend);
164 llvm::BasicBlock* endbb = llvm::BasicBlock::Create("endif", gIR->topfunc(), oldend); 167 llvm::BasicBlock* endbb = llvm::BasicBlock::Create("endif", gIR->topfunc(), oldend);
165 llvm::BasicBlock* elsebb = elsebody ? llvm::BasicBlock::Create("else", gIR->topfunc(), endbb) : endbb; 168 llvm::BasicBlock* elsebb = elsebody ? llvm::BasicBlock::Create("else", gIR->topfunc(), endbb) : endbb;
166 169
167 if (cond_val->getType() != LLType::Int1Ty) { 170 if (cond_val->getType() != LLType::Int1Ty) {
168 Logger::cout() << "if conditional: " << *cond_val << '\n'; 171 if (Logger::enabled())
172 Logger::cout() << "if conditional: " << *cond_val << '\n';
169 cond_val = DtoBoolean(loc, cond_e); 173 cond_val = DtoBoolean(loc, cond_e);
170 } 174 }
171 LLValue* ifgoback = llvm::BranchInst::Create(ifbb, elsebb, cond_val, gIR->scopebb()); 175 LLValue* ifgoback = llvm::BranchInst::Create(ifbb, elsebb, cond_val, gIR->scopebb());
172 176
173 // replace current scope 177 // replace current scope
675 assert(0 && "not char/wchar/dchar"); 679 assert(0 && "not char/wchar/dchar");
676 } 680 }
677 681
678 llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname); 682 llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname);
679 683
680 Logger::cout() << *table->getType() << '\n'; 684 if (Logger::enabled())
681 Logger::cout() << *fn->getFunctionType()->getParamType(0) << '\n'; 685 {
686 Logger::cout() << *table->getType() << '\n';
687 Logger::cout() << *fn->getFunctionType()->getParamType(0) << '\n';
688 }
682 assert(table->getType() == fn->getFunctionType()->getParamType(0)); 689 assert(table->getType() == fn->getFunctionType()->getParamType(0));
683 690
684 DValue* val = e->toElem(gIR); 691 DValue* val = e->toElem(gIR);
685 LLValue* llval; 692 LLValue* llval;
686 if (DSliceValue* sval = val->isSlice()) 693 if (DSliceValue* sval = val->isSlice())