[llvm] 68b1fe8 - [LivePhysRegs] Use MCRegister instead of MCPhysReg in interface. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 6 09:11:57 PST 2025


Author: Craig Topper
Date: 2025-03-06T09:07:53-08:00
New Revision: 68b1fe86283bd8ea7356fa9cbc126fe56178ab2d

URL: https://github.com/llvm/llvm-project/commit/68b1fe86283bd8ea7356fa9cbc126fe56178ab2d
DIFF: https://github.com/llvm/llvm-project/commit/68b1fe86283bd8ea7356fa9cbc126fe56178ab2d.diff

LOG: [LivePhysRegs] Use MCRegister instead of MCPhysReg in interface. NFC

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/LivePhysRegs.h
    llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
    llvm/lib/CodeGen/LivePhysRegs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/LivePhysRegs.h b/llvm/include/llvm/CodeGen/LivePhysRegs.h
index 696e8a0c5dd59..3b3608e4641e7 100644
--- a/llvm/include/llvm/CodeGen/LivePhysRegs.h
+++ b/llvm/include/llvm/CodeGen/LivePhysRegs.h
@@ -80,7 +80,7 @@ class LivePhysRegs {
   bool empty() const { return LiveRegs.empty(); }
 
   /// Adds a physical register and all its sub-registers to the set.
-  void addReg(MCPhysReg Reg) {
+  void addReg(MCRegister Reg) {
     assert(TRI && "LivePhysRegs is not initialized.");
     assert(Reg < TRI->getNumRegs() && "Expected a physical register.");
     for (MCPhysReg SubReg : TRI->subregs_inclusive(Reg))
@@ -89,7 +89,7 @@ class LivePhysRegs {
 
   /// Removes a physical register, all its sub-registers, and all its
   /// super-registers from the set.
-  void removeReg(MCPhysReg Reg) {
+  void removeReg(MCRegister Reg) {
     assert(TRI && "LivePhysRegs is not initialized.");
     assert(Reg < TRI->getNumRegs() && "Expected a physical register.");
     for (MCRegAliasIterator R(Reg, TRI, true); R.isValid(); ++R)
@@ -106,10 +106,10 @@ class LivePhysRegs {
   /// addReg() always adds all sub-registers to the set as well.
   /// Note: Returns false if just some sub registers are live, use available()
   /// when searching a free register.
-  bool contains(MCPhysReg Reg) const { return LiveRegs.count(Reg); }
+  bool contains(MCRegister Reg) const { return LiveRegs.count(Reg.id()); }
 
   /// Returns true if register \p Reg and no aliasing register is in the set.
-  bool available(const MachineRegisterInfo &MRI, MCPhysReg Reg) const;
+  bool available(const MachineRegisterInfo &MRI, MCRegister Reg) const;
 
   /// Remove defined registers and regmask kills from the set.
   void removeDefs(const MachineInstr &MI);

diff  --git a/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp b/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
index 72bcd5874ff83..755be089709a5 100644
--- a/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
+++ b/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
@@ -254,7 +254,7 @@ void AggressiveAntiDepBreaker::GetPassthruRegs(
 /// AntiDepEdges - Return in Edges the anti- and output- dependencies
 /// in SU that we want to consider for breaking.
 static void AntiDepEdges(const SUnit *SU, std::vector<const SDep *> &Edges) {
-  SmallSet<unsigned, 4> RegSet;
+  SmallSet<Register, 4> RegSet;
   for (const SDep &Pred : SU->Preds) {
     if ((Pred.getKind() == SDep::Anti) || (Pred.getKind() == SDep::Output)) {
       if (RegSet.insert(Pred.getReg()).second)

diff  --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp
index f5677bcd6b5f9..f6b325a694d4f 100644
--- a/llvm/lib/CodeGen/LivePhysRegs.cpp
+++ b/llvm/lib/CodeGen/LivePhysRegs.cpp
@@ -139,8 +139,8 @@ LLVM_DUMP_METHOD void LivePhysRegs::dump() const {
 #endif
 
 bool LivePhysRegs::available(const MachineRegisterInfo &MRI,
-                             MCPhysReg Reg) const {
-  if (LiveRegs.count(Reg))
+                             MCRegister Reg) const {
+  if (LiveRegs.count(Reg.id()))
     return false;
   if (MRI.isReserved(Reg))
     return false;


        


More information about the llvm-commits mailing list