Skip to content

Commit 46f7cb3

Browse files
committed
[CodeGen] Use Register::id() instead of implicit cast to unsigned in Register.h. NFC
1 parent 5a6e52d commit 46f7cb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: llvm/include/llvm/CodeGen/Register.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Register {
5151
/// Compute the frame index from a register value representing a stack slot.
5252
static int stackSlot2Index(Register Reg) {
5353
assert(Reg.isStack() && "Not a stack slot");
54-
return int(Reg - MCRegister::FirstStackSlot);
54+
return int(Reg.id() - MCRegister::FirstStackSlot);
5555
}
5656

5757
/// Convert a non-negative frame index to a stack slot register value.
@@ -76,7 +76,7 @@ class Register {
7676
/// The first virtual register in a function will get the index 0.
7777
static unsigned virtReg2Index(Register Reg) {
7878
assert(Reg.isVirtual() && "Not a virtual register");
79-
return Reg & ~MCRegister::VirtualRegFlag;
79+
return Reg.id() & ~MCRegister::VirtualRegFlag;
8080
}
8181

8282
/// Convert a 0-based index to a virtual register number.

0 commit comments

Comments
 (0)