summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SpillPlacement.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-04 00:58:40 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-04 00:58:40 +0000
commitc332e727b4dd8e749ba4fb6b68dc5a0682d3d053 (patch)
tree222a453ff660be968bcd55e61779b91defc7f63a /llvm/lib/CodeGen/SpillPlacement.h
parent9631aae211e557f1ddad20a30d4b4276b853bbec (diff)
downloadbcm5719-llvm-c332e727b4dd8e749ba4fb6b68dc5a0682d3d053.tar.gz
bcm5719-llvm-c332e727b4dd8e749ba4fb6b68dc5a0682d3d053.zip
Precompute block frequencies, pow() isn't free.
llvm-svn: 126975
Diffstat (limited to 'llvm/lib/CodeGen/SpillPlacement.h')
-rw-r--r--llvm/lib/CodeGen/SpillPlacement.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SpillPlacement.h b/llvm/lib/CodeGen/SpillPlacement.h
index ef2d516cdce..b0135cbc365 100644
--- a/llvm/lib/CodeGen/SpillPlacement.h
+++ b/llvm/lib/CodeGen/SpillPlacement.h
@@ -27,6 +27,7 @@
#ifndef LLVM_CODEGEN_SPILLPLACEMENT_H
#define LLVM_CODEGEN_SPILLPLACEMENT_H
+#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
namespace llvm {
@@ -35,7 +36,6 @@ class BitVector;
class EdgeBundles;
class MachineBasicBlock;
class MachineLoopInfo;
-template <typename> class SmallVectorImpl;
class SpillPlacement : public MachineFunctionPass {
struct Node;
@@ -48,6 +48,9 @@ class SpillPlacement : public MachineFunctionPass {
// caller.
BitVector *ActiveNodes;
+ // Block frequencies are computed once. Indexed by block number.
+ SmallVector<float, 4> BlockFrequency;
+
public:
static char ID; // Pass identification, replacement for typeid.
@@ -91,7 +94,9 @@ public:
/// getBlockFrequency - Return the estimated block execution frequency per
/// function invocation.
- float getBlockFrequency(const MachineBasicBlock*);
+ float getBlockFrequency(unsigned Number) const {
+ return BlockFrequency[Number];
+ }
private:
virtual bool runOnMachineFunction(MachineFunction&);
OpenPOWER on IntegriCloud