Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MC] Remove MCRegister::isStackSlot. #127755

Merged
merged 1 commit into from
Feb 19, 2025
Merged

[MC] Remove MCRegister::isStackSlot. #127755

merged 1 commit into from
Feb 19, 2025

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Feb 19, 2025

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

Stack slots should only be stored in Register. The only caller
was Register::isStackSlot so just inline it there.
@llvmbot
Copy link
Member

llvmbot commented Feb 19, 2025

@llvm/pr-subscribers-llvm-regalloc

Author: Craig Topper (topperc)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/127755.diff

2 Files Affected:

  • (modified) llvm/include/llvm/CodeGen/Register.h (+3-2)
  • (modified) llvm/include/llvm/MC/MCRegister.h (-8)
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) {

@topperc topperc merged commit a6f48ed into llvm:main Feb 19, 2025
10 checks passed
@topperc topperc deleted the pr/stackslot branch February 19, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants