Replace one of burr scheduling heuristic with something more sensible. Now calcMaxScratches simply compute the number of true data dependencies. This actually improve a couple of tests in dejagnu suite as many tests in llvm nightly test suite.

llvm-svn: 64369
This commit is contained in:
Evan Cheng 2009-02-12 08:59:45 +00:00
parent eef883327a
commit 3a14efacb6
3 changed files with 6 additions and 19 deletions

View File

@ -916,7 +916,7 @@ CalcNodeSethiUllmanNumber(const SUnit *SU, std::vector<unsigned> &SUNumbers) {
if (PredSethiUllman > SethiUllmanNumber) { if (PredSethiUllman > SethiUllmanNumber) {
SethiUllmanNumber = PredSethiUllman; SethiUllmanNumber = PredSethiUllman;
Extra = 0; Extra = 0;
} else if (PredSethiUllman == SethiUllmanNumber && !I->isCtrl()) } else if (PredSethiUllman == SethiUllmanNumber)
++Extra; ++Extra;
} }
@ -1070,24 +1070,13 @@ static unsigned closestSucc(const SUnit *SU) {
} }
/// calcMaxScratches - Returns an cost estimate of the worse case requirement /// calcMaxScratches - Returns an cost estimate of the worse case requirement
/// for scratch registers. Live-in operands and live-out results don't count /// for scratch registers, i.e. number of data dependencies.
/// since they are "fixed".
static unsigned calcMaxScratches(const SUnit *SU) { static unsigned calcMaxScratches(const SUnit *SU) {
unsigned Scratches = 0; unsigned Scratches = 0;
for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
I != E; ++I) { I != E; ++I)
if (I->isCtrl()) continue; // ignore chain preds if (I->isCtrl()) continue; // ignore chain preds
if (!I->getSUnit()->getNode() ||
I->getSUnit()->getNode()->getOpcode() != ISD::CopyFromReg)
Scratches++; Scratches++;
}
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
if (I->isCtrl()) continue; // ignore chain succs
if (!I->getSUnit()->getNode() ||
I->getSUnit()->getNode()->getOpcode() != ISD::CopyToReg)
Scratches += 10;
}
return Scratches; return Scratches;
} }
@ -1120,10 +1109,7 @@ bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
if (LDist != RDist) if (LDist != RDist)
return LDist < RDist; return LDist < RDist;
// Intuitively, it's good to push down instructions whose results are // How many registers becomes live when the node is scheduled.
// liveout so their long live ranges won't conflict with other values
// which are needed inside the BB. Further prioritize liveout instructions
// by the number of operands which are calculated within the BB.
unsigned LScratch = calcMaxScratches(left); unsigned LScratch = calcMaxScratches(left);
unsigned RScratch = calcMaxScratches(right); unsigned RScratch = calcMaxScratches(right);
if (LScratch != RScratch) if (LScratch != RScratch)

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9 ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 186
%"struct.Adv5::Ekin<3>" = type <{ i8 }> %"struct.Adv5::Ekin<3>" = type <{ i8 }>
%"struct.Adv5::X::Energyflux<3>" = type { double } %"struct.Adv5::X::Energyflux<3>" = type { double }

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -disable-fp-elim -stats -info-output-file - | grep {Number of dead stores elided} | count 1 ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -disable-fp-elim -stats |& grep asm-printer | grep 57
; PR2568 ; PR2568
@g_3 = external global i16 ; <i16*> [#uses=1] @g_3 = external global i16 ; <i16*> [#uses=1]