[block-freq] Store MBFI as a field on SpillPlacement so we can access it to get the...
authorMichael Gottesman <mgottesman@apple.com>
Sat, 14 Dec 2013 00:25:47 +0000 (00:25 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Sat, 14 Dec 2013 00:25:47 +0000 (00:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197291 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SpillPlacement.cpp
lib/CodeGen/SpillPlacement.h

index 10a93b7fa4db53e047a249e9f0634ef2d12e2541..9edcdbcc418e8ec2468fc53898e531712cb21c9f 100644 (file)
@@ -188,10 +188,10 @@ bool SpillPlacement::runOnMachineFunction(MachineFunction &mf) {
 
   // Compute total ingoing and outgoing block frequencies for all bundles.
   BlockFrequencies.resize(mf.getNumBlockIDs());
-  MachineBlockFrequencyInfo &MBFI = getAnalysis<MachineBlockFrequencyInfo>();
+  MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
   for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I) {
     unsigned Num = I->getNumber();
-    BlockFrequencies[Num] = MBFI.getBlockFreq(I);
+    BlockFrequencies[Num] = MBFI->getBlockFreq(I);
   }
 
   // We never change the function.
@@ -221,7 +221,7 @@ void SpillPlacement::activate(unsigned n) {
   // Hopfield network.
   if (bundles->getBlocks(n).size() > 100) {
     nodes[n].BiasP = 0;
-    nodes[n].BiasN = (BlockFrequency::getEntryFrequency() / 16);
+    nodes[n].BiasN = (MBFI->getEntryFrequency() / 16);
   }
 }
 
index 105516bb62b1d3b94342f6d7967e6b56db3a4671..9161195e7168d1854a2367043f26944c2ae69085 100644 (file)
@@ -38,12 +38,14 @@ class BitVector;
 class EdgeBundles;
 class MachineBasicBlock;
 class MachineLoopInfo;
+class MachineBlockFrequencyInfo;
 
 class SpillPlacement  : public MachineFunctionPass {
   struct Node;
   const MachineFunction *MF;
   const EdgeBundles *bundles;
   const MachineLoopInfo *loops;
+  const MachineBlockFrequencyInfo *MBFI;
   Node *nodes;
 
   // Nodes that are active in the current computation. Owned by the prepare()