diff gen/tollvm.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
line wrap: on
line diff
--- a/gen/tollvm.cpp	Wed Feb 04 18:39:39 2009 +0100
+++ b/gen/tollvm.cpp	Wed Feb 04 18:48:03 2009 +0100
@@ -275,7 +275,7 @@
     if (VarDeclaration* vd = sym->isVarDeclaration())
     {
         // template
-        if (DtoIsTemplateInstance(sym))
+        if (needsTemplateLinkage(sym))
             return TEMPLATE_LINKAGE_TYPE;
         // local static
         else if (sym->parent && sym->parent->isFuncDeclaration())
@@ -296,7 +296,7 @@
         // template instances should have weak linkage
         // but only if there's a body, and it's not naked
         // otherwise we make it external
-        else if (DtoIsTemplateInstance(fdecl) && fdecl->fbody && !fdecl->naked)
+        else if (needsTemplateLinkage(fdecl) && fdecl->fbody && !fdecl->naked)
             return TEMPLATE_LINKAGE_TYPE;
         // extern(C) functions are always external
         else if (ft->linkage == LINKc)
@@ -306,7 +306,7 @@
     else if (ClassDeclaration* cd = sym->isClassDeclaration())
     {
         // template
-        if (DtoIsTemplateInstance(cd))
+        if (needsTemplateLinkage(cd))
             return TEMPLATE_LINKAGE_TYPE;
     }
     else
@@ -320,7 +320,7 @@
 
 llvm::GlobalValue::LinkageTypes DtoInternalLinkage(Dsymbol* sym)
 {
-    if (DtoIsTemplateInstance(sym))
+    if (needsTemplateLinkage(sym))
         return TEMPLATE_LINKAGE_TYPE;
     else
         return llvm::GlobalValue::InternalLinkage;
@@ -328,7 +328,7 @@
 
 llvm::GlobalValue::LinkageTypes DtoExternalLinkage(Dsymbol* sym)
 {
-    if (DtoIsTemplateInstance(sym))
+    if (needsTemplateLinkage(sym))
         return TEMPLATE_LINKAGE_TYPE;
     else
         return llvm::GlobalValue::ExternalLinkage;