git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161072
91177308-0d34-0410-b5e6-
96231b3b80d8
//===----------------------------------------------------------------------===//
MachineTraceMetrics::Ensemble::Ensemble(MachineTraceMetrics *ct)
//===----------------------------------------------------------------------===//
MachineTraceMetrics::Ensemble::Ensemble(MachineTraceMetrics *ct)
- : CT(*ct) {
- BlockInfo.resize(CT.BlockInfo.size());
+ : MTM(*ct) {
+ BlockInfo.resize(MTM.BlockInfo.size());
}
// Virtual destructor serves as an anchor.
}
// Virtual destructor serves as an anchor.
const MachineLoop*
MachineTraceMetrics::Ensemble::getLoopFor(const MachineBasicBlock *MBB) const {
const MachineLoop*
MachineTraceMetrics::Ensemble::getLoopFor(const MachineBasicBlock *MBB) const {
- return CT.Loops->getLoopFor(MBB);
+ return MTM.Loops->getLoopFor(MBB);
}
// Update resource-related information in the TraceBlockInfo for MBB.
}
// Update resource-related information in the TraceBlockInfo for MBB.
// predecessor is always computed first.
TraceBlockInfo *PredTBI = &BlockInfo[TBI->Pred->getNumber()];
assert(PredTBI->hasValidDepth() && "Trace above has not been computed yet");
// predecessor is always computed first.
TraceBlockInfo *PredTBI = &BlockInfo[TBI->Pred->getNumber()];
assert(PredTBI->hasValidDepth() && "Trace above has not been computed yet");
- const FixedBlockInfo *PredFBI = CT.getResources(TBI->Pred);
+ const FixedBlockInfo *PredFBI = MTM.getResources(TBI->Pred);
TBI->InstrDepth = PredTBI->InstrDepth + PredFBI->InstrCount;
TBI->Head = PredTBI->Head;
}
TBI->InstrDepth = PredTBI->InstrDepth + PredFBI->InstrCount;
TBI->Head = PredTBI->Head;
}
TraceBlockInfo *TBI = &BlockInfo[MBB->getNumber()];
// Compute resources for the current block.
TraceBlockInfo *TBI = &BlockInfo[MBB->getNumber()];
// Compute resources for the current block.
- TBI->InstrHeight = CT.getResources(MBB)->InstrCount;
+ TBI->InstrHeight = MTM.getResources(MBB)->InstrCount;
// The trace tail is done.
if (!TBI->Succ) {
// The trace tail is done.
if (!TBI->Succ) {
const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*);
public:
const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*);
public:
- MinInstrCountEnsemble(MachineTraceMetrics *ct)
- : MachineTraceMetrics::Ensemble(ct) {}
+ MinInstrCountEnsemble(MachineTraceMetrics *mtm)
+ : MachineTraceMetrics::Ensemble(mtm) {}
// Don't leave loops, and never follow back-edges.
if (CurLoop && MBB == CurLoop->getHeader())
return 0;
// Don't leave loops, and never follow back-edges.
if (CurLoop && MBB == CurLoop->getHeader())
return 0;
- unsigned CurCount = CT.getResources(MBB)->InstrCount;
+ unsigned CurCount = MTM.getResources(MBB)->InstrCount;
const MachineBasicBlock *Best = 0;
unsigned BestDepth = 0;
for (MachineBasicBlock::const_pred_iterator
const MachineBasicBlock *Best = 0;
unsigned BestDepth = 0;
for (MachineBasicBlock::const_pred_iterator
DEBUG(dbgs() << "Computing " << getName() << " trace through BB#"
<< MBB->getNumber() << '\n');
// Set up loop bounds for the backwards post-order traversal.
DEBUG(dbgs() << "Computing " << getName() << " trace through BB#"
<< MBB->getNumber() << '\n');
// Set up loop bounds for the backwards post-order traversal.
- LoopBounds Bounds(BlockInfo, CT.Loops);
+ LoopBounds Bounds(BlockInfo, MTM.Loops);
// Run an upwards post-order search for the trace start.
Bounds.Downward = false;
// Run an upwards post-order search for the trace start.
Bounds.Downward = false;
void MachineTraceMetrics::Ensemble::verify() const {
#ifndef NDEBUG
void MachineTraceMetrics::Ensemble::verify() const {
#ifndef NDEBUG
- assert(BlockInfo.size() == CT.MF->getNumBlockIDs() &&
+ assert(BlockInfo.size() == MTM.MF->getNumBlockIDs() &&
"Outdated BlockInfo size");
for (unsigned Num = 0, e = BlockInfo.size(); Num != e; ++Num) {
const TraceBlockInfo &TBI = BlockInfo[Num];
if (TBI.hasValidDepth() && TBI.Pred) {
"Outdated BlockInfo size");
for (unsigned Num = 0, e = BlockInfo.size(); Num != e; ++Num) {
const TraceBlockInfo &TBI = BlockInfo[Num];
if (TBI.hasValidDepth() && TBI.Pred) {
- const MachineBasicBlock *MBB = CT.MF->getBlockNumbered(Num);
+ const MachineBasicBlock *MBB = MTM.MF->getBlockNumbered(Num);
assert(MBB->isPredecessor(TBI.Pred) && "CFG doesn't match trace");
assert(BlockInfo[TBI.Pred->getNumber()].hasValidDepth() &&
"Trace is broken, depth should have been invalidated.");
assert(MBB->isPredecessor(TBI.Pred) && "CFG doesn't match trace");
assert(BlockInfo[TBI.Pred->getNumber()].hasValidDepth() &&
"Trace is broken, depth should have been invalidated.");
assert(!(Loop && MBB == Loop->getHeader()) && "Trace contains backedge");
}
if (TBI.hasValidHeight() && TBI.Succ) {
assert(!(Loop && MBB == Loop->getHeader()) && "Trace contains backedge");
}
if (TBI.hasValidHeight() && TBI.Succ) {
- const MachineBasicBlock *MBB = CT.MF->getBlockNumbered(Num);
+ const MachineBasicBlock *MBB = MTM.MF->getBlockNumbered(Num);
assert(MBB->isSuccessor(TBI.Succ) && "CFG doesn't match trace");
assert(BlockInfo[TBI.Succ->getNumber()].hasValidHeight() &&
"Trace is broken, height should have been invalidated.");
assert(MBB->isSuccessor(TBI.Succ) && "CFG doesn't match trace");
assert(BlockInfo[TBI.Succ->getNumber()].hasValidHeight() &&
"Trace is broken, height should have been invalidated.");
void computeHeightResources(const MachineBasicBlock*);
protected:
void computeHeightResources(const MachineBasicBlock*);
protected:
- MachineTraceMetrics &CT;
+ MachineTraceMetrics &MTM;
virtual const MachineBasicBlock *pickTracePred(const MachineBasicBlock*) =0;
virtual const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*) =0;
explicit Ensemble(MachineTraceMetrics*);
virtual const MachineBasicBlock *pickTracePred(const MachineBasicBlock*) =0;
virtual const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*) =0;
explicit Ensemble(MachineTraceMetrics*);