[llvm] r206084 - blockfreq: Remove unnecessary template parameters
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Apr 11 16:21:02 PDT 2014
Author: dexonsmith
Date: Fri Apr 11 18:21:02 2014
New Revision: 206084
URL: http://llvm.org/viewvc/llvm-project?rev=206084&view=rev
Log:
blockfreq: Remove unnecessary template parameters
Moves redundant template parameters into an implementation detail of
BlockFrequencyInfoImpl.
No functionality change.
<rdar://problem/14292693>
Modified:
llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h
llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h
llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h?rev=206084&r1=206083&r2=206084&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/BlockFrequencyInfo.h Fri Apr 11 18:21:02 2014
@@ -21,14 +21,12 @@
namespace llvm {
class BranchProbabilityInfo;
-template <class BlockT, class FunctionT, class BranchProbInfoT>
-class BlockFrequencyInfoImpl;
+template <class BlockT> class BlockFrequencyInfoImpl;
/// BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to
/// estimate IR basic block frequencies.
class BlockFrequencyInfo : public FunctionPass {
- typedef BlockFrequencyInfoImpl<BasicBlock, Function, BranchProbabilityInfo>
- ImplType;
+ typedef BlockFrequencyInfoImpl<BasicBlock> ImplType;
std::unique_ptr<ImplType> BFI;
public:
Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h?rev=206084&r1=206083&r2=206084&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/BlockFrequencyInfoImpl.h Fri Apr 11 18:21:02 2014
@@ -29,16 +29,35 @@
namespace llvm {
+class BranchProbabilityInfo;
class BlockFrequencyInfo;
+class MachineBranchProbabilityInfo;
class MachineBlockFrequencyInfo;
+namespace bfi_detail {
+template <class BlockT> struct TypeMap {};
+template <> struct TypeMap<BasicBlock> {
+ typedef BasicBlock BlockT;
+ typedef Function FunctionT;
+ typedef BranchProbabilityInfo BlockProbInfoT;
+};
+template <> struct TypeMap<MachineBasicBlock> {
+ typedef MachineBasicBlock BlockT;
+ typedef MachineFunction FunctionT;
+ typedef MachineBranchProbabilityInfo BlockProbInfoT;
+};
+}
+
/// BlockFrequencyInfoImpl implements block frequency algorithm for IR and
/// Machine Instructions. Algorithm starts with value ENTRY_FREQ
/// for the entry block and then propagates frequencies using branch weights
/// from (Machine)BranchProbabilityInfo. LoopInfo is not required because
/// algorithm can find "backedges" by itself.
-template<class BlockT, class FunctionT, class BlockProbInfoT>
+template <class BT>
class BlockFrequencyInfoImpl {
+ typedef typename bfi_detail::TypeMap<BT>::BlockT BlockT;
+ typedef typename bfi_detail::TypeMap<BT>::FunctionT FunctionT;
+ typedef typename bfi_detail::TypeMap<BT>::BlockProbInfoT BlockProbInfoT;
DenseMap<const BlockT *, BlockFrequency> Freqs;
Modified: llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h?rev=206084&r1=206083&r2=206084&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBlockFrequencyInfo.h Fri Apr 11 18:21:02 2014
@@ -22,14 +22,12 @@ namespace llvm {
class MachineBasicBlock;
class MachineBranchProbabilityInfo;
-template <class BlockT, class FunctionT, class BranchProbInfoT>
-class BlockFrequencyInfoImpl;
+template <class BlockT> class BlockFrequencyInfoImpl;
/// MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation
/// to estimate machine basic block frequencies.
class MachineBlockFrequencyInfo : public MachineFunctionPass {
- typedef BlockFrequencyInfoImpl<MachineBasicBlock, MachineFunction,
- MachineBranchProbabilityInfo> ImplType;
+ typedef BlockFrequencyInfoImpl<MachineBasicBlock> ImplType;
std::unique_ptr<ImplType> MBFI;
public:
More information about the llvm-commits
mailing list