comparison gen/structs.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 a15ccbf7451d
comparison
equal deleted inserted replaced
619:722630261d62 622:26fce59fe80a
27 TypeStruct* ts = (TypeStruct*)si->ad->type; 27 TypeStruct* ts = (TypeStruct*)si->ad->type;
28 28
29 DtoResolveDsymbol(si->ad); 29 DtoResolveDsymbol(si->ad);
30 30
31 const llvm::StructType* structtype = isaStruct(ts->ir.type->get()); 31 const llvm::StructType* structtype = isaStruct(ts->ir.type->get());
32 Logger::cout() << "llvm struct type: " << *structtype << '\n'; 32
33 if (Logger::enabled())
34 Logger::cout() << "llvm struct type: " << *structtype << '\n';
33 35
34 assert(si->value.dim == si->vars.dim); 36 assert(si->value.dim == si->vars.dim);
35 37
36 std::vector<DUnionIdx> inits; 38 std::vector<DUnionIdx> inits;
37 for (int i = 0; i < si->value.dim; ++i) 39 for (int i = 0; i < si->value.dim; ++i)
59 idxs.push_back(0); 61 idxs.push_back(0);
60 62
61 const LLType* llt = getPtrToType(DtoType(t)); 63 const LLType* llt = getPtrToType(DtoType(t));
62 const LLType* st = getPtrToType(DtoType(sd->type)); 64 const LLType* st = getPtrToType(DtoType(sd->type));
63 65
64 Logger::cout() << "ptr = " << *ptr << '\n'; 66 if (Logger::enabled())
65 Logger::cout() << "st = " << *st << '\n'; 67 {
68 Logger::cout() << "ptr = " << *ptr << '\n';
69 Logger::cout() << "st = " << *st << '\n';
70 }
66 71
67 if (ptr->getType() != st) { 72 if (ptr->getType() != st) {
68 assert(sd->ir.irStruct->hasUnions); 73 assert(sd->ir.irStruct->hasUnions);
69 ptr = gIR->ir->CreateBitCast(ptr, st, "tmp"); 74 ptr = gIR->ir->CreateBitCast(ptr, st, "tmp");
70 } 75 }