[block-freq] Store MBFI as a field on SpillPlacement so we can access it to get the entry frequency while processing data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197291 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael Gottesman 2013-12-14 00:25:47 +00:00
parent c1b4dfd345
commit 1a938c2beb
2 changed files with 5 additions and 3 deletions

View 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);
}
}

View 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()