[PATCH] D88598: [NFC] Let (MC)Register APIs check isStackSlot
Mircea Trofin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 1 09:55:48 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG17640c5aac64: [NFC] Let (MC)Register APIs check isStackSlot (authored by mtrofin).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88598/new/
https://reviews.llvm.org/D88598
Files:
llvm/include/llvm/CodeGen/Register.h
llvm/include/llvm/MC/MCRegister.h
Index: llvm/include/llvm/MC/MCRegister.h
===================================================================
--- llvm/include/llvm/MC/MCRegister.h
+++ llvm/include/llvm/MC/MCRegister.h
@@ -46,9 +46,6 @@
/// register. StackSlot values do not exist in the MC layer, see
/// Register::isStackSlot() for the more information on them.
///
- /// Note that isVirtualRegister() and isPhysicalRegister() cannot handle stack
- /// slots, so if a variable may contains a stack slot, always check
- /// isStackSlot() first.
static bool isStackSlot(unsigned Reg) {
return !(Reg & VirtualRegFlag) &&
uint32_t(Reg & ~VirtualRegFlag) >= FirstStackSlot;
@@ -57,8 +54,8 @@
/// Return true if the specified register number is in
/// the physical register namespace.
static bool isPhysicalRegister(unsigned Reg) {
- assert(!isStackSlot(Reg) && "Not a register! Check isStackSlot() first.");
- return Reg >= FirstPhysicalReg && !(Reg & VirtualRegFlag);
+ return Reg >= FirstPhysicalReg && !(Reg & VirtualRegFlag) &&
+ !isStackSlot(Reg);
}
/// Return true if the specified register number is in the physical register
Index: llvm/include/llvm/CodeGen/Register.h
===================================================================
--- llvm/include/llvm/CodeGen/Register.h
+++ llvm/include/llvm/CodeGen/Register.h
@@ -40,10 +40,6 @@
/// frame index in a variable that normally holds a register. isStackSlot()
/// returns true if Reg is in the range used for stack slots.
///
- /// Note that isVirtualRegister() and isPhysicalRegister() cannot handle stack
- /// slots, so if a variable may contains a stack slot, always check
- /// isStackSlot() first.
- ///
static bool isStackSlot(unsigned Reg) {
return MCRegister::isStackSlot(Reg);
}
@@ -69,8 +65,7 @@
/// Return true if the specified register number is in
/// the virtual register namespace.
static bool isVirtualRegister(unsigned Reg) {
- assert(!isStackSlot(Reg) && "Not a register! Check isStackSlot() first.");
- return Reg & MCRegister::VirtualRegFlag;
+ return Reg & MCRegister::VirtualRegFlag && !isStackSlot(Reg);
}
/// Convert a virtual register number to a 0-based index.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88598.295608.patch
Type: text/x-patch
Size: 2230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201001/150fe68f/attachment.bin>
More information about the llvm-commits
mailing list