From e12e3cd8f4581d2a64147f9a62a314d60cb9dcc1 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 18 Feb 2025 22:55:30 -0800 Subject: [PATCH] [MC] Remove MCRegister::isStackSlot. Stack slots should only be stored in Register. The only caller was Register::isStackSlot so just inline it there. --- llvm/include/llvm/CodeGen/Register.h | 5 +++-- llvm/include/llvm/MC/MCRegister.h | 8 -------- 2 files changed, 3 insertions(+), 10 deletions(-) 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) {