aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineTraceMetrics.cpp
diff options
context:
space:
mode:
authorMichael Maitland <michaeltmaitland@gmail.com>2023-08-22 17:00:50 -0700
committerMichael Maitland <michaeltmaitland@gmail.com>2023-08-24 19:21:36 -0700
commit85e3875ad7461fa8320db6895e0189cffb91ae7d (patch)
treebb79a45adc3a5eafd3931ba2d6b2a118b7abbc97 /llvm/lib/CodeGen/MachineTraceMetrics.cpp
parent604aba0c8b79c48b7330ad654067c671786984c2 (diff)
downloadllvm-85e3875ad7461fa8320db6895e0189cffb91ae7d.zip
llvm-85e3875ad7461fa8320db6895e0189cffb91ae7d.tar.gz
llvm-85e3875ad7461fa8320db6895e0189cffb91ae7d.tar.bz2
[TableGen] Rename ResourceCycles and StartAtCycle to clarify semantics
D150312 added a TODO: TODO: consider renaming the field `StartAtCycle` and `Cycles` to `AcquireAtCycle` and `ReleaseAtCycle` respectively, to stress the fact that resource allocation is now represented as an interval, relatively to the issue cycle of the instruction. This patch implements that TODO. This naming clarifies how to use these fields in the scheduler. In addition it was confusing that `StartAtCycle` was singular but `Cycles` was plural. This renaming fixes this inconsistency. This commit as previously reverted since it missed renaming that came down after rebasing. This version of the commit fixes those problems. Differential Revision: https://reviews.llvm.org/D158568
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineTraceMetrics.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.cpp b/llvm/lib/CodeGen/MachineTraceMetrics.cpp
index 4f66f2e..3e6f36f 100644
--- a/llvm/lib/CodeGen/MachineTraceMetrics.cpp
+++ b/llvm/lib/CodeGen/MachineTraceMetrics.cpp
@@ -71,7 +71,7 @@ bool MachineTraceMetrics::runOnMachineFunction(MachineFunction &Func) {
Loops = &getAnalysis<MachineLoopInfo>();
SchedModel.init(&ST);
BlockInfo.resize(MF->getNumBlockIDs());
- ProcResourceCycles.resize(MF->getNumBlockIDs() *
+ ProcReleaseAtCycles.resize(MF->getNumBlockIDs() *
SchedModel.getNumProcResourceKinds());
return false;
}
@@ -126,7 +126,7 @@ MachineTraceMetrics::getResources(const MachineBasicBlock *MBB) {
PI = SchedModel.getWriteProcResBegin(SC),
PE = SchedModel.getWriteProcResEnd(SC); PI != PE; ++PI) {
assert(PI->ProcResourceIdx < PRKinds && "Bad processor resource kind");
- PRCycles[PI->ProcResourceIdx] += PI->Cycles;
+ PRCycles[PI->ProcResourceIdx] += PI->ReleaseAtCycle;
}
}
FBI->InstrCount = InstrCount;
@@ -134,19 +134,19 @@ MachineTraceMetrics::getResources(const MachineBasicBlock *MBB) {
// Scale the resource cycles so they are comparable.
unsigned PROffset = MBB->getNumber() * PRKinds;
for (unsigned K = 0; K != PRKinds; ++K)
- ProcResourceCycles[PROffset + K] =
+ ProcReleaseAtCycles[PROffset + K] =
PRCycles[K] * SchedModel.getResourceFactor(K);
return FBI;
}
ArrayRef<unsigned>
-MachineTraceMetrics::getProcResourceCycles(unsigned MBBNum) const {
+MachineTraceMetrics::getProcReleaseAtCycles(unsigned MBBNum) const {
assert(BlockInfo[MBBNum].hasResources() &&
- "getResources() must be called before getProcResourceCycles()");
+ "getResources() must be called before getProcReleaseAtCycles()");
unsigned PRKinds = SchedModel.getNumProcResourceKinds();
- assert((MBBNum+1) * PRKinds <= ProcResourceCycles.size());
- return ArrayRef(ProcResourceCycles.data() + MBBNum * PRKinds, PRKinds);
+ assert((MBBNum+1) * PRKinds <= ProcReleaseAtCycles.size());
+ return ArrayRef(ProcReleaseAtCycles.data() + MBBNum * PRKinds, PRKinds);
}
//===----------------------------------------------------------------------===//
@@ -197,7 +197,7 @@ computeDepthResources(const MachineBasicBlock *MBB) {
// Compute per-resource depths.
ArrayRef<unsigned> PredPRDepths = getProcResourceDepths(PredNum);
- ArrayRef<unsigned> PredPRCycles = MTM.getProcResourceCycles(PredNum);
+ ArrayRef<unsigned> PredPRCycles = MTM.getProcReleaseAtCycles(PredNum);
for (unsigned K = 0; K != PRKinds; ++K)
ProcResourceDepths[PROffset + K] = PredPRDepths[K] + PredPRCycles[K];
}
@@ -212,7 +212,7 @@ computeHeightResources(const MachineBasicBlock *MBB) {
// Compute resources for the current block.
TBI->InstrHeight = MTM.getResources(MBB)->InstrCount;
- ArrayRef<unsigned> PRCycles = MTM.getProcResourceCycles(MBB->getNumber());
+ ArrayRef<unsigned> PRCycles = MTM.getProcReleaseAtCycles(MBB->getNumber());
// The trace tail is done.
if (!TBI->Succ) {
@@ -1204,7 +1204,7 @@ unsigned MachineTraceMetrics::Trace::getResourceDepth(bool Bottom) const {
unsigned PRMax = 0;
ArrayRef<unsigned> PRDepths = TE.getProcResourceDepths(getBlockNum());
if (Bottom) {
- ArrayRef<unsigned> PRCycles = TE.MTM.getProcResourceCycles(getBlockNum());
+ ArrayRef<unsigned> PRCycles = TE.MTM.getProcReleaseAtCycles(getBlockNum());
for (unsigned K = 0; K != PRDepths.size(); ++K)
PRMax = std::max(PRMax, PRDepths[K] + PRCycles[K]);
} else {
@@ -1248,8 +1248,8 @@ unsigned MachineTraceMetrics::Trace::getResourceLength(
PI != PE; ++PI) {
if (PI->ProcResourceIdx != ResourceIdx)
continue;
- Cycles +=
- (PI->Cycles * TE.MTM.SchedModel.getResourceFactor(ResourceIdx));
+ Cycles += (PI->ReleaseAtCycle *
+ TE.MTM.SchedModel.getResourceFactor(ResourceIdx));
}
}
return Cycles;
@@ -1258,7 +1258,7 @@ unsigned MachineTraceMetrics::Trace::getResourceLength(
for (unsigned K = 0; K != PRDepths.size(); ++K) {
unsigned PRCycles = PRDepths[K] + PRHeights[K];
for (const MachineBasicBlock *MBB : Extrablocks)
- PRCycles += TE.MTM.getProcResourceCycles(MBB->getNumber())[K];
+ PRCycles += TE.MTM.getProcReleaseAtCycles(MBB->getNumber())[K];
PRCycles += extraCycles(ExtraInstrs, K);
PRCycles -= extraCycles(RemoveInstrs, K);
PRMax = std::max(PRMax, PRCycles);