mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +00:00
[block-freq] Update MachineBlockPlacement and RegAllocGreedy to use the new MachineBlockFrequencyInfo methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197290 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b8c5cfb130
commit
c1b4dfd345
@ -461,8 +461,8 @@ MachineBasicBlock *MachineBlockPlacement::selectBestCandidateBlock(
|
|||||||
assert(SuccChain.LoopPredecessors == 0 && "Found CFG-violating block");
|
assert(SuccChain.LoopPredecessors == 0 && "Found CFG-violating block");
|
||||||
|
|
||||||
BlockFrequency CandidateFreq = MBFI->getBlockFreq(*WBI);
|
BlockFrequency CandidateFreq = MBFI->getBlockFreq(*WBI);
|
||||||
DEBUG(dbgs() << " " << getBlockName(*WBI) << " -> " << CandidateFreq
|
DEBUG(dbgs() << " " << getBlockName(*WBI) << " -> ";
|
||||||
<< " (freq)\n");
|
MBFI->printBlockFreq(dbgs(), CandidateFreq) << " (freq)\n");
|
||||||
if (BestBlock && BestFreq >= CandidateFreq)
|
if (BestBlock && BestFreq >= CandidateFreq)
|
||||||
continue;
|
continue;
|
||||||
BestBlock = *WBI;
|
BestBlock = *WBI;
|
||||||
@ -583,8 +583,8 @@ MachineBlockPlacement::findBestLoopTop(MachineLoop &L,
|
|||||||
if (!LoopBlockSet.count(Pred))
|
if (!LoopBlockSet.count(Pred))
|
||||||
continue;
|
continue;
|
||||||
DEBUG(dbgs() << " header pred: " << getBlockName(Pred) << ", "
|
DEBUG(dbgs() << " header pred: " << getBlockName(Pred) << ", "
|
||||||
<< Pred->succ_size() << " successors, "
|
<< Pred->succ_size() << " successors, ";
|
||||||
<< MBFI->getBlockFreq(Pred) << " freq\n");
|
MBFI->printBlockFreq(dbgs(), Pred) << " freq\n");
|
||||||
if (Pred->succ_size() > 1)
|
if (Pred->succ_size() > 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -698,7 +698,8 @@ MachineBlockPlacement::findBestLoopExit(MachineFunction &F,
|
|||||||
BlockFrequency ExitEdgeFreq = MBFI->getBlockFreq(*I) * SuccProb;
|
BlockFrequency ExitEdgeFreq = MBFI->getBlockFreq(*I) * SuccProb;
|
||||||
DEBUG(dbgs() << " exiting: " << getBlockName(*I) << " -> "
|
DEBUG(dbgs() << " exiting: " << getBlockName(*I) << " -> "
|
||||||
<< getBlockName(*SI) << " [L:" << SuccLoopDepth
|
<< getBlockName(*SI) << " [L:" << SuccLoopDepth
|
||||||
<< "] (" << ExitEdgeFreq << ")\n");
|
<< "] (";
|
||||||
|
MBFI->printBlockFreq(dbgs(), ExitEdgeFreq) << ")\n");
|
||||||
// Note that we bias this toward an existing layout successor to retain
|
// Note that we bias this toward an existing layout successor to retain
|
||||||
// incoming order in the absence of better information. The exit must have
|
// incoming order in the absence of better information. The exit must have
|
||||||
// a frequency higher than the current exit before we consider breaking
|
// a frequency higher than the current exit before we consider breaking
|
||||||
|
@ -1203,7 +1203,8 @@ unsigned RAGreedy::tryRegionSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
|||||||
// No benefit from the compact region, our fallback will be per-block
|
// No benefit from the compact region, our fallback will be per-block
|
||||||
// splitting. Make sure we find a solution that is cheaper than spilling.
|
// splitting. Make sure we find a solution that is cheaper than spilling.
|
||||||
BestCost = calcSpillCost();
|
BestCost = calcSpillCost();
|
||||||
DEBUG(dbgs() << "Cost of isolating all blocks = " << BestCost << '\n');
|
DEBUG(dbgs() << "Cost of isolating all blocks = ";
|
||||||
|
MBFI->printBlockFreq(dbgs(), BestCost) << '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
Order.rewind();
|
Order.rewind();
|
||||||
@ -1237,7 +1238,8 @@ unsigned RAGreedy::tryRegionSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
|||||||
DEBUG(dbgs() << PrintReg(PhysReg, TRI) << "\tno positive bundles\n");
|
DEBUG(dbgs() << PrintReg(PhysReg, TRI) << "\tno positive bundles\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DEBUG(dbgs() << PrintReg(PhysReg, TRI) << "\tstatic = " << Cost);
|
DEBUG(dbgs() << PrintReg(PhysReg, TRI) << "\tstatic = ";
|
||||||
|
MBFI->printBlockFreq(dbgs(), Cost));
|
||||||
if (Cost >= BestCost) {
|
if (Cost >= BestCost) {
|
||||||
DEBUG({
|
DEBUG({
|
||||||
if (BestCand == NoCand)
|
if (BestCand == NoCand)
|
||||||
@ -1260,7 +1262,8 @@ unsigned RAGreedy::tryRegionSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
|||||||
|
|
||||||
Cost += calcGlobalSplitCost(Cand);
|
Cost += calcGlobalSplitCost(Cand);
|
||||||
DEBUG({
|
DEBUG({
|
||||||
dbgs() << ", total = " << Cost << " with bundles";
|
dbgs() << ", total = "; MBFI->printBlockFreq(dbgs(), Cost)
|
||||||
|
<< " with bundles";
|
||||||
for (int i = Cand.LiveBundles.find_first(); i>=0;
|
for (int i = Cand.LiveBundles.find_first(); i>=0;
|
||||||
i = Cand.LiveBundles.find_next(i))
|
i = Cand.LiveBundles.find_next(i))
|
||||||
dbgs() << " EB#" << i;
|
dbgs() << " EB#" << i;
|
||||||
@ -1588,7 +1591,7 @@ unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order,
|
|||||||
|
|
||||||
const float blockFreq =
|
const float blockFreq =
|
||||||
SpillPlacer->getBlockFrequency(BI.MBB->getNumber()).getFrequency() *
|
SpillPlacer->getBlockFrequency(BI.MBB->getNumber()).getFrequency() *
|
||||||
(1.0f / BlockFrequency::getEntryFrequency());
|
(1.0f / MBFI->getEntryFrequency());
|
||||||
SmallVector<float, 8> GapWeight;
|
SmallVector<float, 8> GapWeight;
|
||||||
|
|
||||||
Order.rewind();
|
Order.rewind();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user