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

llvm-svn: 197291
This commit is contained in:
Michael Gottesman 2013-12-14 00:25:47 +00:00
parent b78dec8faf
commit 092647b37a
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. // Compute total ingoing and outgoing block frequencies for all bundles.
BlockFrequencies.resize(mf.getNumBlockIDs()); BlockFrequencies.resize(mf.getNumBlockIDs());
MachineBlockFrequencyInfo &MBFI = getAnalysis<MachineBlockFrequencyInfo>(); MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I) { for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I) {
unsigned Num = I->getNumber(); unsigned Num = I->getNumber();
BlockFrequencies[Num] = MBFI.getBlockFreq(I); BlockFrequencies[Num] = MBFI->getBlockFreq(I);
} }
// We never change the function. // We never change the function.
@ -221,7 +221,7 @@ void SpillPlacement::activate(unsigned n) {
// Hopfield network. // Hopfield network.
if (bundles->getBlocks(n).size() > 100) { if (bundles->getBlocks(n).size() > 100) {
nodes[n].BiasP = 0; 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 EdgeBundles;
class MachineBasicBlock; class MachineBasicBlock;
class MachineLoopInfo; class MachineLoopInfo;
class MachineBlockFrequencyInfo;
class SpillPlacement : public MachineFunctionPass { class SpillPlacement : public MachineFunctionPass {
struct Node; struct Node;
const MachineFunction *MF; const MachineFunction *MF;
const EdgeBundles *bundles; const EdgeBundles *bundles;
const MachineLoopInfo *loops; const MachineLoopInfo *loops;
const MachineBlockFrequencyInfo *MBFI;
Node *nodes; Node *nodes;
// Nodes that are active in the current computation. Owned by the prepare() // Nodes that are active in the current computation. Owned by the prepare()