[llvm] a6f48ed - [MC] Remove MCRegister::isStackSlot. (#127755)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 10:19:45 PST 2025


Author: Craig Topper
Date: 2025-02-19T10:19:40-08:00
New Revision: a6f48ed01292d0007e19a2605cba1acd4ecd123a

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

LOG: [MC] Remove MCRegister::isStackSlot. (#127755)

Stack slots should only be stored in Register. The only caller was
Register::isStackSlot so just inline it there.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/Register.h
    llvm/include/llvm/MC/MCRegister.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/Register.h b/llvm/include/llvm/CodeGen/Register.h
index 8a0bf3dc71ad2..ad05368bea6a4 100644
--- a/llvm/include/llvm/CodeGen/Register.h
+++ b/llvm/include/llvm/CodeGen/Register.h
@@ -42,11 +42,12 @@ class Register {
   ///
   /// FIXME: remove in favor of member.
   static constexpr bool isStackSlot(unsigned Reg) {
-    return MCRegister::isStackSlot(Reg);
+    return MCRegister::FirstStackSlot <= Reg &&
+           Reg < MCRegister::VirtualRegFlag;
   }
 
   /// Return true if this is a stack slot.
-  constexpr bool isStack() const { return MCRegister::isStackSlot(Reg); }
+  constexpr bool isStack() const { return isStackSlot(Reg); }
 
   /// Compute the frame index from a register value representing a stack slot.
   static int stackSlot2Index(Register Reg) {

diff  --git a/llvm/include/llvm/MC/MCRegister.h b/llvm/include/llvm/MC/MCRegister.h
index 53005bb03c2ee..16d0709753b35 100644
--- a/llvm/include/llvm/MC/MCRegister.h
+++ b/llvm/include/llvm/MC/MCRegister.h
@@ -54,14 +54,6 @@ class MCRegister {
   static constexpr unsigned FirstStackSlot = 1u << 30;
   static constexpr unsigned VirtualRegFlag = 1u << 31;
 
-  /// This is the portion of the positive number space that is not a physical
-  /// register. StackSlot values do not exist in the MC layer, see
-  /// Register::isStackSlot() for the more information on them.
-  ///
-  static constexpr bool isStackSlot(unsigned Reg) {
-    return FirstStackSlot <= Reg && Reg < VirtualRegFlag;
-  }
-
   /// Return true if the specified register number is in
   /// the physical register namespace.
   static constexpr bool isPhysicalRegister(unsigned Reg) {


        


More information about the llvm-commits mailing list