From 85e3875ad7461fa8320db6895e0189cffb91ae7d Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Tue, 22 Aug 2023 17:00:50 -0700 Subject: [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 --- llvm/lib/CodeGen/MachinePipeliner.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp') diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index c7e7497..adcbf65 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -1039,7 +1039,7 @@ struct FuncUnitSorter { for (const MCWriteProcResEntry &PRE : make_range(STI->getWriteProcResBegin(SCDesc), STI->getWriteProcResEnd(SCDesc))) { - if (!PRE.Cycles) + if (!PRE.ReleaseAtCycle) continue; const MCProcResourceDesc *ProcResource = STI->getSchedModel().getProcResource(PRE.ProcResourceIdx); @@ -1082,7 +1082,7 @@ struct FuncUnitSorter { for (const MCWriteProcResEntry &PRE : make_range(STI->getWriteProcResBegin(SCDesc), STI->getWriteProcResEnd(SCDesc))) { - if (!PRE.Cycles) + if (!PRE.ReleaseAtCycle) continue; Resources[PRE.ProcResourceIdx]++; } @@ -3092,7 +3092,7 @@ void ResourceManager::reserveResources(const MCSchedClassDesc *SCDesc, assert(!UseDFA); for (const MCWriteProcResEntry &PRE : make_range( STI->getWriteProcResBegin(SCDesc), STI->getWriteProcResEnd(SCDesc))) - for (int C = Cycle; C < Cycle + PRE.Cycles; ++C) + for (int C = Cycle; C < Cycle + PRE.ReleaseAtCycle; ++C) ++MRT[positiveModulo(C, InitiationInterval)][PRE.ProcResourceIdx]; for (int C = Cycle; C < Cycle + SCDesc->NumMicroOps; ++C) @@ -3104,7 +3104,7 @@ void ResourceManager::unreserveResources(const MCSchedClassDesc *SCDesc, assert(!UseDFA); for (const MCWriteProcResEntry &PRE : make_range( STI->getWriteProcResBegin(SCDesc), STI->getWriteProcResEnd(SCDesc))) - for (int C = Cycle; C < Cycle + PRE.Cycles; ++C) + for (int C = Cycle; C < Cycle + PRE.ReleaseAtCycle; ++C) --MRT[positiveModulo(C, InitiationInterval)][PRE.ProcResourceIdx]; for (int C = Cycle; C < Cycle + SCDesc->NumMicroOps; ++C) @@ -3220,10 +3220,10 @@ int ResourceManager::calculateResMII() const { if (SwpDebugResource) { const MCProcResourceDesc *Desc = SM.getProcResource(PRE.ProcResourceIdx); - dbgs() << Desc->Name << ": " << PRE.Cycles << ", "; + dbgs() << Desc->Name << ": " << PRE.ReleaseAtCycle << ", "; } }); - ResourceCount[PRE.ProcResourceIdx] += PRE.Cycles; + ResourceCount[PRE.ProcResourceIdx] += PRE.ReleaseAtCycle; } LLVM_DEBUG(if (SwpDebugResource) dbgs() << "\n"); } -- cgit v1.1