[llvm-commits] [llvm] r158840 - in /llvm/trunk/include/llvm: Analysis/LoopInfo.h CodeGen/MachineLoopInfo.h
Andrew Trick
atrick at apple.com
Wed Jun 20 13:17:21 PDT 2012
Author: atrick
Date: Wed Jun 20 15:17:20 2012
New Revision: 158840
URL: http://llvm.org/viewvc/llvm-project?rev=158840&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Analysis/LoopInfo.h
llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=158840&r1=158839&r2=158840&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Wed Jun 20 15:17:20 2012
@@ -316,6 +316,11 @@
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 @@
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>;
Modified: llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h?rev=158840&r1=158839&r2=158840&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineLoopInfo.h Wed Jun 20 15:17:20 2012
@@ -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 @@
: 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>;
More information about the llvm-commits
mailing list