[CodeGen] Remove static member functions Register::stackSlot2Index/isStackSlot. NFC
Migrate the few users to the nonstatic member functions.
This commit is contained in:
@@ -116,9 +116,7 @@ struct RegisterRef {
|
||||
static constexpr bool isUnitId(unsigned Id) {
|
||||
return Register::isVirtualRegister(Id);
|
||||
}
|
||||
static constexpr bool isMaskId(unsigned Id) {
|
||||
return Register::isStackSlot(Id);
|
||||
}
|
||||
static constexpr bool isMaskId(unsigned Id) { return Register(Id).isStack(); }
|
||||
|
||||
static constexpr RegisterId toUnitId(unsigned Idx) {
|
||||
return Idx | MCRegister::VirtualRegFlag;
|
||||
@@ -147,7 +145,7 @@ struct PhysicalRegisterInfo {
|
||||
}
|
||||
|
||||
const uint32_t *getRegMaskBits(RegisterId R) const {
|
||||
return RegMasks.get(Register::stackSlot2Index(R));
|
||||
return RegMasks.get(Register(R).stackSlotIndex());
|
||||
}
|
||||
|
||||
bool alias(RegisterRef RA, RegisterRef RB) const;
|
||||
@@ -160,7 +158,7 @@ struct PhysicalRegisterInfo {
|
||||
}
|
||||
|
||||
const BitVector &getMaskUnits(RegisterId MaskId) const {
|
||||
return MaskInfos[Register::stackSlot2Index(MaskId)].Units;
|
||||
return MaskInfos[Register(MaskId).stackSlotIndex()].Units;
|
||||
}
|
||||
|
||||
std::set<RegisterId> getUnits(RegisterRef RR) const;
|
||||
|
||||
@@ -36,25 +36,12 @@ public:
|
||||
static_assert(std::numeric_limits<decltype(Reg)>::max() >= 0xFFFFFFFF,
|
||||
"Reg isn't large enough to hold full range.");
|
||||
|
||||
/// isStackSlot - Sometimes it is useful to be able to store a non-negative
|
||||
/// frame index in a variable that normally holds a register. isStackSlot()
|
||||
/// returns true if Reg is in the range used for stack slots.
|
||||
///
|
||||
/// FIXME: remove in favor of member.
|
||||
static constexpr bool isStackSlot(unsigned Reg) {
|
||||
/// Return true if this is a stack slot.
|
||||
constexpr bool isStack() const {
|
||||
return MCRegister::FirstStackSlot <= Reg &&
|
||||
Reg < MCRegister::VirtualRegFlag;
|
||||
}
|
||||
|
||||
/// Return true if this is a stack slot.
|
||||
constexpr bool isStack() const { return isStackSlot(Reg); }
|
||||
|
||||
/// Compute the frame index from a register value representing a stack slot.
|
||||
static int stackSlot2Index(Register Reg) {
|
||||
assert(Reg.isStack() && "Not a stack slot");
|
||||
return int(Reg.id() - MCRegister::FirstStackSlot);
|
||||
}
|
||||
|
||||
/// Convert a non-negative frame index to a stack slot register value.
|
||||
static Register index2StackSlot(int FI) {
|
||||
assert(FI >= 0 && "Cannot hold a negative frame index.");
|
||||
|
||||
@@ -1285,8 +1285,7 @@ void InlineSpiller::spillAll() {
|
||||
void InlineSpiller::spill(LiveRangeEdit &edit) {
|
||||
++NumSpilledRanges;
|
||||
Edit = &edit;
|
||||
assert(!Register::isStackSlot(edit.getReg()) &&
|
||||
"Trying to spill a stack slot.");
|
||||
assert(!edit.getReg().isStack() && "Trying to spill a stack slot.");
|
||||
// Share a stack slot among all descendants of Original.
|
||||
Original = VRM.getOriginal(edit.getReg());
|
||||
StackSlot = VRM.getStackSlot(Original);
|
||||
|
||||
@@ -263,7 +263,7 @@ void PhysicalRegisterInfo::print(raw_ostream &OS, RegisterRef A) const {
|
||||
} else {
|
||||
assert(A.isMask());
|
||||
// RegMask SS flag is preserved by idx().
|
||||
unsigned Idx = Register::stackSlot2Index(A.idx());
|
||||
unsigned Idx = Register(A.idx()).stackSlotIndex();
|
||||
const char *Fmt = Idx < 0x10000 ? "%04x" : "%08x";
|
||||
OS << "M#" << format(Fmt, Idx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user