Add extern template instantiations of llvm::Calculate.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 14 Feb 2014 22:36:16 +0000 (22:36 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 14 Feb 2014 22:36:16 +0000 (22:36 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201440 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Dominators.h
lib/IR/Dominators.cpp

index 9090457bcf098dab9a24dabf63325be51ca0c58a..0faa3b886fe9f769e7e3b85b63cd68a6081d0910 100644 (file)
@@ -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 {
index 8fa742f745a3d0d4653f0acafecadb238ab657ff..baa6019098d2311a4de6252489d3f4481012b0de 100644 (file)
@@ -64,6 +64,16 @@ bool BasicBlockEdge::isSingleEdge() const {
 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!