Skip to content

Commit

Permalink
[MachineScheduler] Rename Reg2SUnitsMap to RegUnit2SUnitsMap
Browse files Browse the repository at this point in the history
This is a follow up to D156552.
  • Loading branch information
jayfoad committed Aug 8, 2023
1 parent 4e8cae4 commit d9c0166
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace llvm {
/// Use a SparseMultiSet to track physical registers. Storage is only
/// allocated once for the pass. It can be cleared in constant time and reused
/// without any frees.
using Reg2SUnitsMap =
using RegUnit2SUnitsMap =
SparseMultiSet<PhysRegSUOper, identity<unsigned>, uint16_t>;

/// Use SparseSet as a SparseMap by relying on the fact that it never
Expand Down Expand Up @@ -166,8 +166,8 @@ namespace llvm {
/// iterate upward through the instructions. This is allocated here instead
/// of inside BuildSchedGraph to avoid the need for it to be initialized and
/// destructed for each block.
Reg2SUnitsMap Defs;
Reg2SUnitsMap Uses;
RegUnit2SUnitsMap Defs;
RegUnit2SUnitsMap Uses;

/// Tracks the last instruction(s) in this region defining each virtual
/// register. There may be multiple current definitions for a register with
Expand Down
12 changes: 7 additions & 5 deletions llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ void ScheduleDAGInstrs::addPhysRegDataDeps(SUnit *SU, unsigned OperIdx) {
bool ImplicitPseudoDef = (OperIdx >= DefMIDesc.getNumOperands() &&
!DefMIDesc.hasImplicitDefOfPhysReg(Reg));
for (MCRegUnit Unit : TRI->regunits(Reg)) {
for (Reg2SUnitsMap::iterator I = Uses.find(Unit); I != Uses.end(); ++I) {
for (RegUnit2SUnitsMap::iterator I = Uses.find(Unit); I != Uses.end();
++I) {
SUnit *UseSU = I->SU;
if (UseSU == SU)
continue;
Expand Down Expand Up @@ -308,7 +309,8 @@ void ScheduleDAGInstrs::addPhysRegDeps(SUnit *SU, unsigned OperIdx) {
// there's no cost for reusing registers.
SDep::Kind Kind = MO.isUse() ? SDep::Anti : SDep::Output;
for (MCRegUnit Unit : TRI->regunits(Reg)) {
for (Reg2SUnitsMap::iterator I = Defs.find(Unit); I != Defs.end(); ++I) {
for (RegUnit2SUnitsMap::iterator I = Defs.find(Unit); I != Defs.end();
++I) {
SUnit *DefSU = I->SU;
if (DefSU == &ExitSU)
continue;
Expand Down Expand Up @@ -353,9 +355,9 @@ void ScheduleDAGInstrs::addPhysRegDeps(SUnit *SU, unsigned OperIdx) {
// the block. Instead, we leave only one call at the back of the
// DefList.
for (MCRegUnit Unit : TRI->regunits(Reg)) {
Reg2SUnitsMap::RangePair P = Defs.equal_range(Unit);
Reg2SUnitsMap::iterator B = P.first;
Reg2SUnitsMap::iterator I = P.second;
RegUnit2SUnitsMap::RangePair P = Defs.equal_range(Unit);
RegUnit2SUnitsMap::iterator B = P.first;
RegUnit2SUnitsMap::iterator I = P.second;
for (bool isBegin = I == B; !isBegin; /* empty */) {
isBegin = (--I) == B;
if (!I->SU->isCall)
Expand Down

0 comments on commit d9c0166

Please sign in to comment.