summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SpillPlacement.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/SpillPlacement.h')
-rw-r--r--lib/CodeGen/SpillPlacement.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/SpillPlacement.h b/lib/CodeGen/SpillPlacement.h
index fc412f817cd..a0480d587d6 100644
--- a/lib/CodeGen/SpillPlacement.h
+++ b/lib/CodeGen/SpillPlacement.h
@@ -30,6 +30,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/BlockFrequency.h"
namespace llvm {
@@ -57,7 +58,7 @@ class SpillPlacement : public MachineFunctionPass {
SmallVector<unsigned, 8> RecentPositive;
// Block frequencies are computed once. Indexed by block number.
- SmallVector<float, 4> BlockFrequency;
+ SmallVector<BlockFrequency, 4> BlockFrequencies;
public:
static char ID; // Pass identification, replacement for typeid.
@@ -140,7 +141,9 @@ public:
/// getBlockFrequency - Return the estimated block execution frequency per
/// function invocation.
float getBlockFrequency(unsigned Number) const {
- return BlockFrequency[Number];
+ // FIXME: Return the BlockFrequency directly.
+ const float Scale = 1.0f / BlockFrequency::getEntryFrequency();
+ return BlockFrequencies[Number].getFrequency() * Scale;
}
private: