Mercurial > projects > ldc
comparison gen/functions.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 | fbb1a366cfbc |
children | df196c8dea26 |
comparison
equal
deleted
inserted
replaced
619:722630261d62 | 622:26fce59fe80a |
---|---|
162 } | 162 } |
163 | 163 |
164 // handle lazy args | 164 // handle lazy args |
165 if (arg->storageClass & STClazy) | 165 if (arg->storageClass & STClazy) |
166 { | 166 { |
167 Logger::cout() << "for lazy got: " << *paramvec.back() << '\n'; | 167 if (Logger::enabled()) |
168 Logger::cout() << "for lazy got: " << *paramvec.back() << '\n'; | |
169 | |
168 TypeFunction *ltf = new TypeFunction(NULL, arg->type, 0, LINKd); | 170 TypeFunction *ltf = new TypeFunction(NULL, arg->type, 0, LINKd); |
169 TypeDelegate *ltd = new TypeDelegate(ltf); | 171 TypeDelegate *ltd = new TypeDelegate(ltf); |
170 at = getPtrToType(DtoType(ltd)); | 172 at = getPtrToType(DtoType(ltd)); |
171 Logger::cout() << "lazy updated to: " << *at << '\n'; | 173 |
174 if (Logger::enabled()) | |
175 Logger::cout() << "lazy updated to: " << *at << '\n'; | |
176 | |
172 paramvec.back() = at; | 177 paramvec.back() = at; |
173 // lazy doesn't need byval as the delegate is not visible to the user | 178 // lazy doesn't need byval as the delegate is not visible to the user |
174 } | 179 } |
175 } | 180 } |
176 | 181 |
287 fdecl->ir.resolved = true; | 292 fdecl->ir.resolved = true; |
288 | 293 |
289 Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars()); | 294 Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars()); |
290 LOG_SCOPE; | 295 LOG_SCOPE; |
291 | 296 |
297 //printf("resolve function: %s\n", fdecl->toPrettyChars()); | |
298 | |
292 if (fdecl->parent) | 299 if (fdecl->parent) |
293 if (TemplateInstance* tinst = fdecl->parent->isTemplateInstance()) | 300 if (TemplateInstance* tinst = fdecl->parent->isTemplateInstance()) |
294 { | 301 { |
295 TemplateDeclaration* tempdecl = tinst->tempdecl; | 302 TemplateDeclaration* tempdecl = tinst->tempdecl; |
296 if (tempdecl->llvmInternal == LLVMva_arg) | 303 if (tempdecl->llvmInternal == LLVMva_arg) |
388 if (fdecl->ir.declared) return; | 395 if (fdecl->ir.declared) return; |
389 fdecl->ir.declared = true; | 396 fdecl->ir.declared = true; |
390 | 397 |
391 Logger::println("DtoDeclareFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars()); | 398 Logger::println("DtoDeclareFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars()); |
392 LOG_SCOPE; | 399 LOG_SCOPE; |
400 | |
401 //printf("declare function: %s\n", fdecl->toPrettyChars()); | |
393 | 402 |
394 // intrinsic sanity check | 403 // intrinsic sanity check |
395 if (fdecl->llvmInternal == LLVMintrinsic && fdecl->fbody) { | 404 if (fdecl->llvmInternal == LLVMintrinsic && fdecl->fbody) { |
396 error(fdecl->loc, "intrinsics cannot have function bodies"); | 405 error(fdecl->loc, "intrinsics cannot have function bodies"); |
397 fatal(); | 406 fatal(); |
528 if (!declareOnly) | 537 if (!declareOnly) |
529 gIR->defineList.push_back(fdecl); | 538 gIR->defineList.push_back(fdecl); |
530 else | 539 else |
531 assert(func->getLinkage() != llvm::GlobalValue::InternalLinkage); | 540 assert(func->getLinkage() != llvm::GlobalValue::InternalLinkage); |
532 | 541 |
533 Logger::cout() << "func decl: " << *func << '\n'; | 542 if (Logger::enabled()) |
543 Logger::cout() << "func decl: " << *func << '\n'; | |
534 } | 544 } |
535 | 545 |
536 ////////////////////////////////////////////////////////////////////////////////////////// | 546 ////////////////////////////////////////////////////////////////////////////////////////// |
537 | 547 |
538 void DtoDefineFunc(FuncDeclaration* fd) | 548 void DtoDefineFunc(FuncDeclaration* fd) |