Mercurial > projects > ldc
comparison gen/classes.cpp @ 940:39519a1ff603
Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 04 Feb 2009 18:48:03 +0100 |
parents | 545f54041d91 |
children | 03d7c4aac654 |
comparison
equal
deleted
inserted
replaced
939:cac9895be400 | 940:39519a1ff603 |
---|---|
322 | 322 |
323 // request const init | 323 // request const init |
324 gIR->constInitList.push_back(cd); | 324 gIR->constInitList.push_back(cd); |
325 | 325 |
326 // emit typeinfo and request definition | 326 // emit typeinfo and request definition |
327 if (cd->getModule() == gIR->dmodule || DtoIsTemplateInstance(cd)) | 327 if (mustDefineSymbol(cd)) |
328 { | 328 { |
329 gIR->defineList.push_back(cd); | 329 gIR->defineList.push_back(cd); |
330 DtoTypeInfoOf(cd->type, false); | 330 DtoTypeInfoOf(cd->type, false); |
331 } | 331 } |
332 } | 332 } |
358 IrStruct* irstruct = cd->ir.irStruct; | 358 IrStruct* irstruct = cd->ir.irStruct; |
359 | 359 |
360 gIR->structs.push_back(irstruct); | 360 gIR->structs.push_back(irstruct); |
361 | 361 |
362 bool needs_definition = false; | 362 bool needs_definition = false; |
363 if (cd->getModule() == gIR->dmodule || DtoIsTemplateInstance(cd)) { | 363 if (mustDefineSymbol(cd)) { |
364 needs_definition = true; | 364 needs_definition = true; |
365 } | 365 } |
366 | 366 |
367 llvm::GlobalValue::LinkageTypes _linkage = DtoLinkage(cd); | 367 llvm::GlobalValue::LinkageTypes _linkage = DtoLinkage(cd); |
368 | 368 |
819 | 819 |
820 // defined interface infos | 820 // defined interface infos |
821 DefineInterfaceInfos(cd->ir.irStruct); | 821 DefineInterfaceInfos(cd->ir.irStruct); |
822 | 822 |
823 // define the classinfo | 823 // define the classinfo |
824 if (cd->getModule() == gIR->dmodule || DtoIsTemplateInstance(cd)) | 824 if (mustDefineSymbol(cd)) |
825 { | 825 { |
826 DtoDefineClassInfo(cd); | 826 DtoDefineClassInfo(cd); |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
849 assert(cd->type->ty == Tclass); | 849 assert(cd->type->ty == Tclass); |
850 TypeClass* ts = (TypeClass*)cd->type; | 850 TypeClass* ts = (TypeClass*)cd->type; |
851 | 851 |
852 IrStruct* irstruct = cd->ir.irStruct; | 852 IrStruct* irstruct = cd->ir.irStruct; |
853 | 853 |
854 assert(cd->getModule() == gIR->dmodule || DtoIsTemplateInstance(cd)); | 854 assert(mustDefineSymbol(cd)); |
855 | 855 |
856 // sanity check | 856 // sanity check |
857 assert(irstruct->init); | 857 assert(irstruct->init); |
858 assert(irstruct->constInit); | 858 assert(irstruct->constInit); |
859 assert(irstruct->vtbl); | 859 assert(irstruct->vtbl); |