mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
Rename CT -> MTM. MachineTraceMetrics is abbreviated MTM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161072 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
603f69dc2c
commit
64e2973bf7
@ -100,8 +100,8 @@ MachineTraceMetrics::getResources(const MachineBasicBlock *MBB) {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
MachineTraceMetrics::Ensemble::Ensemble(MachineTraceMetrics *ct)
|
MachineTraceMetrics::Ensemble::Ensemble(MachineTraceMetrics *ct)
|
||||||
: CT(*ct) {
|
: MTM(*ct) {
|
||||||
BlockInfo.resize(CT.BlockInfo.size());
|
BlockInfo.resize(MTM.BlockInfo.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Virtual destructor serves as an anchor.
|
// Virtual destructor serves as an anchor.
|
||||||
@ -109,7 +109,7 @@ MachineTraceMetrics::Ensemble::~Ensemble() {}
|
|||||||
|
|
||||||
const MachineLoop*
|
const MachineLoop*
|
||||||
MachineTraceMetrics::Ensemble::getLoopFor(const MachineBasicBlock *MBB) const {
|
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.
|
||||||
@ -129,7 +129,7 @@ computeDepthResources(const MachineBasicBlock *MBB) {
|
|||||||
// predecessor is always computed first.
|
// predecessor is always computed first.
|
||||||
TraceBlockInfo *PredTBI = &BlockInfo[TBI->Pred->getNumber()];
|
TraceBlockInfo *PredTBI = &BlockInfo[TBI->Pred->getNumber()];
|
||||||
assert(PredTBI->hasValidDepth() && "Trace above has not been computed yet");
|
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->InstrDepth = PredTBI->InstrDepth + PredFBI->InstrCount;
|
||||||
TBI->Head = PredTBI->Head;
|
TBI->Head = PredTBI->Head;
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ computeHeightResources(const MachineBasicBlock *MBB) {
|
|||||||
TraceBlockInfo *TBI = &BlockInfo[MBB->getNumber()];
|
TraceBlockInfo *TBI = &BlockInfo[MBB->getNumber()];
|
||||||
|
|
||||||
// Compute resources for the current block.
|
// Compute resources for the current block.
|
||||||
TBI->InstrHeight = CT.getResources(MBB)->InstrCount;
|
TBI->InstrHeight = MTM.getResources(MBB)->InstrCount;
|
||||||
|
|
||||||
// The trace tail is done.
|
// The trace tail is done.
|
||||||
if (!TBI->Succ) {
|
if (!TBI->Succ) {
|
||||||
@ -208,8 +208,8 @@ class MinInstrCountEnsemble : public MachineTraceMetrics::Ensemble {
|
|||||||
const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*);
|
const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MinInstrCountEnsemble(MachineTraceMetrics *ct)
|
MinInstrCountEnsemble(MachineTraceMetrics *mtm)
|
||||||
: MachineTraceMetrics::Ensemble(ct) {}
|
: MachineTraceMetrics::Ensemble(mtm) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ MinInstrCountEnsemble::pickTracePred(const MachineBasicBlock *MBB) {
|
|||||||
// Don't leave loops, and never follow back-edges.
|
// Don't leave loops, and never follow back-edges.
|
||||||
if (CurLoop && MBB == CurLoop->getHeader())
|
if (CurLoop && MBB == CurLoop->getHeader())
|
||||||
return 0;
|
return 0;
|
||||||
unsigned CurCount = CT.getResources(MBB)->InstrCount;
|
unsigned CurCount = MTM.getResources(MBB)->InstrCount;
|
||||||
const MachineBasicBlock *Best = 0;
|
const MachineBasicBlock *Best = 0;
|
||||||
unsigned BestDepth = 0;
|
unsigned BestDepth = 0;
|
||||||
for (MachineBasicBlock::const_pred_iterator
|
for (MachineBasicBlock::const_pred_iterator
|
||||||
@ -360,7 +360,7 @@ void MachineTraceMetrics::Ensemble::computeTrace(const MachineBasicBlock *MBB) {
|
|||||||
DEBUG(dbgs() << "Computing " << getName() << " trace through BB#"
|
DEBUG(dbgs() << "Computing " << getName() << " trace through BB#"
|
||||||
<< MBB->getNumber() << '\n');
|
<< MBB->getNumber() << '\n');
|
||||||
// Set up loop bounds for the backwards post-order traversal.
|
// 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.
|
// Run an upwards post-order search for the trace start.
|
||||||
Bounds.Downward = false;
|
Bounds.Downward = false;
|
||||||
@ -462,12 +462,12 @@ MachineTraceMetrics::Ensemble::invalidate(const MachineBasicBlock *BadMBB) {
|
|||||||
|
|
||||||
void MachineTraceMetrics::Ensemble::verify() const {
|
void MachineTraceMetrics::Ensemble::verify() const {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(BlockInfo.size() == CT.MF->getNumBlockIDs() &&
|
assert(BlockInfo.size() == MTM.MF->getNumBlockIDs() &&
|
||||||
"Outdated BlockInfo size");
|
"Outdated BlockInfo size");
|
||||||
for (unsigned Num = 0, e = BlockInfo.size(); Num != e; ++Num) {
|
for (unsigned Num = 0, e = BlockInfo.size(); Num != e; ++Num) {
|
||||||
const TraceBlockInfo &TBI = BlockInfo[Num];
|
const TraceBlockInfo &TBI = BlockInfo[Num];
|
||||||
if (TBI.hasValidDepth() && TBI.Pred) {
|
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(MBB->isPredecessor(TBI.Pred) && "CFG doesn't match trace");
|
||||||
assert(BlockInfo[TBI.Pred->getNumber()].hasValidDepth() &&
|
assert(BlockInfo[TBI.Pred->getNumber()].hasValidDepth() &&
|
||||||
"Trace is broken, depth should have been invalidated.");
|
"Trace is broken, depth should have been invalidated.");
|
||||||
@ -475,7 +475,7 @@ void MachineTraceMetrics::Ensemble::verify() const {
|
|||||||
assert(!(Loop && MBB == Loop->getHeader()) && "Trace contains backedge");
|
assert(!(Loop && MBB == Loop->getHeader()) && "Trace contains backedge");
|
||||||
}
|
}
|
||||||
if (TBI.hasValidHeight() && TBI.Succ) {
|
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(MBB->isSuccessor(TBI.Succ) && "CFG doesn't match trace");
|
||||||
assert(BlockInfo[TBI.Succ->getNumber()].hasValidHeight() &&
|
assert(BlockInfo[TBI.Succ->getNumber()].hasValidHeight() &&
|
||||||
"Trace is broken, height should have been invalidated.");
|
"Trace is broken, height should have been invalidated.");
|
||||||
|
@ -176,7 +176,7 @@ public:
|
|||||||
void computeHeightResources(const MachineBasicBlock*);
|
void computeHeightResources(const MachineBasicBlock*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MachineTraceMetrics &CT;
|
MachineTraceMetrics &MTM;
|
||||||
virtual const MachineBasicBlock *pickTracePred(const MachineBasicBlock*) =0;
|
virtual const MachineBasicBlock *pickTracePred(const MachineBasicBlock*) =0;
|
||||||
virtual const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*) =0;
|
virtual const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock*) =0;
|
||||||
explicit Ensemble(MachineTraceMetrics*);
|
explicit Ensemble(MachineTraceMetrics*);
|
||||||
|
Loading…
Reference in New Issue
Block a user