[llvm] r201440 - Add extern template instantiations of llvm::Calculate.

Rafael Espindola rafael.espindola at gmail.com
Fri Feb 14 14:36:16 PST 2014


Author: rafael
Date: Fri Feb 14 16:36:16 2014
New Revision: 201440

URL: http://llvm.org/viewvc/llvm-project?rev=201440&view=rev
Log:
Add extern template instantiations of llvm::Calculate.

This should be a small build time improvement in general and fixes
the build on OS X with -DBUILD_SHARED_LIBS=ON.

The issue is that not all users are including GenericDomTreeConstruction.h,
causing undefined references when ld64 managed to hide the
linkonce_odr symbols.

Modified:
    llvm/trunk/include/llvm/IR/Dominators.h
    llvm/trunk/lib/IR/Dominators.cpp

Modified: llvm/trunk/include/llvm/IR/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Dominators.h?rev=201440&r1=201439&r2=201440&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Dominators.h (original)
+++ llvm/trunk/include/llvm/IR/Dominators.h Fri Feb 14 16:36:16 2014
@@ -34,6 +34,17 @@ namespace llvm {
 EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase<BasicBlock>);
 EXTERN_TEMPLATE_INSTANTIATION(class DominatorTreeBase<BasicBlock>);
 
+#define LLVM_COMMA ,
+EXTERN_TEMPLATE_INSTANTIATION(
+    void llvm::Calculate<Function LLVM_COMMA BasicBlock *>(
+        DominatorTreeBase<typename GraphTraits<BasicBlock *>::NodeType> &DT
+            LLVM_COMMA Function &F));
+EXTERN_TEMPLATE_INSTANTIATION(void llvm::Calculate<
+    Function LLVM_COMMA Inverse<BasicBlock *> >(DominatorTreeBase<
+    typename GraphTraits<Inverse<BasicBlock *> >::NodeType> &DT LLVM_COMMA
+                                                    Function &F));
+#undef LLVM_COMMA
+
 typedef DomTreeNodeBase<BasicBlock> DomTreeNode;
 
 class BasicBlockEdge {

Modified: llvm/trunk/lib/IR/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Dominators.cpp?rev=201440&r1=201439&r2=201440&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Dominators.cpp (original)
+++ llvm/trunk/lib/IR/Dominators.cpp Fri Feb 14 16:36:16 2014
@@ -64,6 +64,16 @@ bool BasicBlockEdge::isSingleEdge() cons
 TEMPLATE_INSTANTIATION(class llvm::DomTreeNodeBase<BasicBlock>);
 TEMPLATE_INSTANTIATION(class llvm::DominatorTreeBase<BasicBlock>);
 
+#define LLVM_COMMA ,
+TEMPLATE_INSTANTIATION(void llvm::Calculate<Function LLVM_COMMA BasicBlock *>(
+    DominatorTreeBase<typename GraphTraits<BasicBlock *>::NodeType> &DT
+        LLVM_COMMA Function &F));
+TEMPLATE_INSTANTIATION(void llvm::Calculate<
+    Function LLVM_COMMA Inverse<BasicBlock *> >(DominatorTreeBase<
+    typename GraphTraits<Inverse<BasicBlock *> >::NodeType> &DT LLVM_COMMA
+                                                    Function &F));
+#undef LLVM_COMMA
+
 // dominates - Return true if Def dominates a use in User. This performs
 // the special checks necessary if Def and User are in the same basic block.
 // Note that Def doesn't dominate a use in Def itself!





More information about the llvm-commits mailing list