diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-07-01 23:19:39 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-07-01 23:19:39 +0000 |
commit | 74d2a3e1a014b93e9037a7b04e85dc92bfb54fa7 (patch) | |
tree | 4f02bba5c303c60c83a17659cd196e2ec8f9f8eb /lib/CodeGen/SpillPlacement.h | |
parent | a785a7bf51726d3fbfb907beb3112eed6b850a3c (diff) | |
download | llvm-74d2a3e1a014b93e9037a7b04e85dc92bfb54fa7.tar.gz llvm-74d2a3e1a014b93e9037a7b04e85dc92bfb54fa7.tar.bz2 llvm-74d2a3e1a014b93e9037a7b04e85dc92bfb54fa7.tar.xz |
Remove floating point computations form SpillPlacement.cpp.
Patch by Benjamin Kramer!
Use the BlockFrequency class instead of floats in the Hopfield network
computations. This rescales the node Bias field from a [-2;2] float
range to two block frequencies BiasN and BiasP pulling in opposite
directions. This construct has a more predictable behavior when block
frequencies saturate.
The per-node scaling factors are no longer necessary, assuming the block
frequencies around a bundle are consistent.
This patch can cause the register allocator to make different spilling
decisions. The differences should be small.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SpillPlacement.h')
-rw-r--r-- | lib/CodeGen/SpillPlacement.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/SpillPlacement.h b/lib/CodeGen/SpillPlacement.h index fc412f817c..a0480d587d 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: |