diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp index c03e0d1fcf6b..627614d991d5 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -1668,7 +1668,7 @@ void CodeGenRegBank::computeRegUnitSets() { dbgs() << "UnitSet " << USIdx << " " << RegUnitSets[USIdx].Name << ":"; for (auto &U : RegUnitSets[USIdx].Units) - dbgs() << " " << RegUnits[U].Roots[0]->getName(); + printRegUnitName(U); dbgs() << "\n"; }); @@ -1681,7 +1681,7 @@ void CodeGenRegBank::computeRegUnitSets() { dbgs() << "UnitSet " << USIdx << " " << RegUnitSets[USIdx].Name << ":"; for (auto &U : RegUnitSets[USIdx].Units) - dbgs() << " " << RegUnits[U].Roots[0]->getName(); + printRegUnitName(U); dbgs() << "\n"; } dbgs() << "\nUnion sets:\n"); @@ -1727,7 +1727,7 @@ void CodeGenRegBank::computeRegUnitSets() { DEBUG(dbgs() << "UnitSet " << RegUnitSets.size()-1 << " " << RegUnitSets.back().Name << ":"; for (auto &U : RegUnitSets.back().Units) - dbgs() << " " << RegUnits[U].Roots[0]->getName(); + printRegUnitName(U); dbgs() << "\n";); } } @@ -1742,7 +1742,7 @@ void CodeGenRegBank::computeRegUnitSets() { dbgs() << "UnitSet " << USIdx << " " << RegUnitSets[USIdx].Name << ":"; for (auto &U : RegUnitSets[USIdx].Units) - dbgs() << " " << RegUnits[U].Roots[0]->getName(); + printRegUnitName(U); dbgs() << "\n"; }); @@ -1763,8 +1763,8 @@ void CodeGenRegBank::computeRegUnitSets() { continue; DEBUG(dbgs() << "RC " << RC.getName() << " Units: \n"; - for (auto &U : RCRegUnits) - dbgs() << RegUnits[U].getRoots()[0]->getName() << " "; + for (auto U : RCRegUnits) + printRegUnitName(U); dbgs() << "\n UnitSetIDs:"); // Find all supersets. @@ -2170,3 +2170,10 @@ BitVector CodeGenRegBank::computeCoveredRegisters(ArrayRef Regs) { BV.set(Set[i]->EnumValue); return BV; } + +void CodeGenRegBank::printRegUnitName(unsigned Unit) const { + if (Unit < NumNativeRegUnits) + dbgs() << ' ' << RegUnits[Unit].Roots[0]->getName(); + else + dbgs() << " #" << Unit; +} diff --git a/llvm/utils/TableGen/CodeGenRegisters.h b/llvm/utils/TableGen/CodeGenRegisters.h index 3ed26fa401a1..9366838c77cd 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.h +++ b/llvm/utils/TableGen/CodeGenRegisters.h @@ -735,6 +735,10 @@ namespace llvm { // LaneMask is contained in CoveringLanes will be completely covered by // another sub-register with the same or larger lane mask. LaneBitmask CoveringLanes; + + // Helper function for printing debug information. Handles artificial + // (non-native) reg units. + void printRegUnitName(unsigned Unit) const; }; } // end namespace llvm