summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-06-20 20:17:20 +0000
committerAndrew Trick <atrick@apple.com>2012-06-20 20:17:20 +0000
commit60c7d5bc2cbeff9eff16716295ffd6a5374dc6bc (patch)
treea04289fffab73f2728e2d6da2f609d1e72065949 /include
parent3affd9e8f366f241adbbc57ef53489ff2052db4f (diff)
downloadllvm-60c7d5bc2cbeff9eff16716295ffd6a5374dc6bc.tar.gz
llvm-60c7d5bc2cbeff9eff16716295ffd6a5374dc6bc.tar.bz2
llvm-60c7d5bc2cbeff9eff16716295ffd6a5374dc6bc.tar.xz
Add "extern template" declarations now that we use explicit instantiation.
This is supported by gcc and clang, but guarded by a macro for MSVC 2008. The extern template declaration is not necessary but generally good form. It can avoid extra instantiations of the template methods defined inline. The EXTERN_TEMPLATE_INSTANTIATION macro could probably be generalized to handle multiple template parameters if someone thinks it's worthwhile. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158840 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/LoopInfo.h10
-rw-r--r--include/llvm/CodeGen/MachineLoopInfo.h14
2 files changed, 23 insertions, 1 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 453633b305..14d87e0034 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -316,6 +316,11 @@ raw_ostream& operator<<(raw_ostream &OS, const LoopBase<BlockT, LoopT> &Loop) {
return OS;
}
+// Implementation in LoopInfoImpl.h
+#ifdef __GNUC__
+__extension__ extern template class LoopBase<BasicBlock, Loop>;
+#endif
+
class Loop : public LoopBase<BasicBlock, Loop> {
public:
Loop() {}
@@ -541,6 +546,11 @@ public:
void print(raw_ostream &OS) const;
};
+// Implementation in LoopInfoImpl.h
+#ifdef __GNUC__
+__extension__ extern template class LoopInfoBase<BasicBlock, Loop>;
+#endif
+
class LoopInfo : public FunctionPass {
LoopInfoBase<BasicBlock, Loop> LI;
friend class LoopBase<BasicBlock, Loop>;
diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h
index 6dd9440500..3e204bed15 100644
--- a/include/llvm/CodeGen/MachineLoopInfo.h
+++ b/include/llvm/CodeGen/MachineLoopInfo.h
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file defines the MachineLoopInfo class that is used to identify natural
+// This file defines the MachineLoopInfo class that is used to identify natural
// loops and determine the loop depth of various nodes of the CFG. Note that
// natural loops may actually be several loops that share the same header node.
//
@@ -35,6 +35,12 @@
namespace llvm {
+// Implementation in LoopInfoImpl.h
+#ifdef __GNUC__
+class MachineLoop;
+__extension__ extern template class LoopBase<MachineBasicBlock, MachineLoop>;
+#endif
+
class MachineLoop : public LoopBase<MachineBasicBlock, MachineLoop> {
public:
MachineLoop();
@@ -57,6 +63,12 @@ private:
: LoopBase<MachineBasicBlock, MachineLoop>(MBB) {}
};
+// Implementation in LoopInfoImpl.h
+#ifdef __GNUC__
+__extension__ extern template
+class LoopInfoBase<MachineBasicBlock, MachineLoop>;
+#endif
+
class MachineLoopInfo : public MachineFunctionPass {
LoopInfoBase<MachineBasicBlock, MachineLoop> LI;
friend class LoopBase<MachineBasicBlock, MachineLoop>;