From f55c1c85881afd65647bde5346f64d9685235c7c Mon Sep 17 00:00:00 2001 From: Jakub Staszak Date: Mon, 25 Jul 2011 19:25:40 +0000 Subject: Rename BlockFrequency to BlockFrequencyInfo and MachineBlockFrequency to MachineBlockFrequencyInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135937 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineBlockFrequencyInfo.h | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 include/llvm/CodeGen/MachineBlockFrequencyInfo.h (limited to 'include/llvm/CodeGen/MachineBlockFrequencyInfo.h') diff --git a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h new file mode 100644 index 0000000..8902455 --- /dev/null +++ b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h @@ -0,0 +1,53 @@ +//====----- MachineBlockFrequencyInfo.h - MachineBlock Frequency Analysis ----====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Loops should be simplified before this analysis. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H +#define LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H + +#include "llvm/CodeGen/MachineFunctionPass.h" +#include + +namespace llvm { + +class MachineBranchProbabilityInfo; +template +class BlockFrequencyImpl; + +/// MachineBlockFrequencyInfo pass uses BlockFrequencyImpl implementation to estimate +/// machine basic block frequencies. +class MachineBlockFrequencyInfo : public MachineFunctionPass { + + BlockFrequencyImpl *MBFI; + +public: + static char ID; + + MachineBlockFrequencyInfo(); + + ~MachineBlockFrequencyInfo(); + + void getAnalysisUsage(AnalysisUsage &AU) const; + + bool runOnMachineFunction(MachineFunction &F); + + /// getblockFreq - Return block frequency. Return 0 if we don't have the + /// information. Please note that initial frequency is equal to 1024. It means + /// that we should not rely on the value itself, but only on the comparison to + /// the other block frequencies. We do this to avoid using of floating points. + /// + uint32_t getBlockFreq(MachineBasicBlock *MBB); +}; + +} + +#endif -- cgit v1.1 From 14a73679c356994bf81e57f7f22880c15a2d7760 Mon Sep 17 00:00:00 2001 From: Jakub Staszak Date: Mon, 25 Jul 2011 20:08:00 +0000 Subject: Fix #include guard directive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135947 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineBlockFrequencyInfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/llvm/CodeGen/MachineBlockFrequencyInfo.h') diff --git a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h index 8902455..f888e54 100644 --- a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h +++ b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H -#define LLVM_CODEGEN_MACHINEBLOCKFREQUENCY_H +#ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H +#define LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H #include "llvm/CodeGen/MachineFunctionPass.h" #include -- cgit v1.1 From 9a24f1f070f7a9e18f7fc46214c2f2d0a38ab0f9 Mon Sep 17 00:00:00 2001 From: Jakub Staszak Date: Wed, 27 Jul 2011 22:05:51 +0000 Subject: Use BlockFrequency instead of uint32_t in BlockFrequencyInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136278 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineBlockFrequencyInfo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/llvm/CodeGen/MachineBlockFrequencyInfo.h') diff --git a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h index f888e54..63ab2ef 100644 --- a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h +++ b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h @@ -15,6 +15,7 @@ #define LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/Support/BlockFrequency.h" #include namespace llvm { @@ -45,7 +46,7 @@ public: /// that we should not rely on the value itself, but only on the comparison to /// the other block frequencies. We do this to avoid using of floating points. /// - uint32_t getBlockFreq(MachineBasicBlock *MBB); + BlockFrequency getBlockFreq(MachineBasicBlock *MBB); }; } -- cgit v1.1 From 8ea45231dc6c30d0c4a55ce038a08edccc308a73 Mon Sep 17 00:00:00 2001 From: Jakub Staszak Date: Wed, 3 Aug 2011 21:30:57 +0000 Subject: Add more constantness in BlockFrequencyInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136816 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineBlockFrequencyInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/llvm/CodeGen/MachineBlockFrequencyInfo.h') diff --git a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h index 63ab2ef..416d40b 100644 --- a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h +++ b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h @@ -46,7 +46,7 @@ public: /// that we should not rely on the value itself, but only on the comparison to /// the other block frequencies. We do this to avoid using of floating points. /// - BlockFrequency getBlockFreq(MachineBasicBlock *MBB); + BlockFrequency getBlockFreq(MachineBasicBlock *MBB) const; }; } -- cgit v1.1