[llvm] [CodeGen] Add Register::stackSlotIndex(). Replace uses of Register::stackSlot2Index. NFC (PR #125028)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 21:35:21 PST 2025
================
@@ -98,6 +98,12 @@ class Register {
/// register in a function will get the index 0.
unsigned virtRegIndex() const { return virtReg2Index(Reg); }
+ /// Compute the frame index from a register value representing a stack slot.
+ int stackSlotIndex() const {
+ assert(isStack() && "Not a stack slot");
+ return int(Reg - MCRegister::FirstStackSlot);
----------------
arsenm wrote:
```suggestion
return static_cast<int>(Reg - MCRegister::FirstStackSlot);
```
https://github.com/llvm/llvm-project/pull/125028
More information about the llvm-commits
mailing list