by removing casts from unsigned to int that which may be implementation
defined according to C++14 (and thus trip up the XL compiler on AIX) by
just using unsigned comparisons/masks and refactor out the range
constants to cleanup things a bit while we are at it.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/CodeGen/Register.h | ||
---|---|---|
73 | Note: We use the number interpretation here but then the bitmask interpretation below. Please see later comment. | |
80 | I think we should stick purely with either the bitmask or the number interpretation. The name of MCRegister::FirstVirtualReg does not work well with the bitmask interpretation; however, since the bitmask operation is only valid given information that is not readily apparent to the compiler here (without adding a cast to uint32_t and changing the assert to llvm_unreachable), I guess the answer is to rename in favour of the bitmask interpretation. I'm using VirtualRegFlag in other comments for discussion purposes. | |
86–87 | Should there be an assert that the "index" does not already have the indicator bit set? | |
llvm/include/llvm/MC/MCRegister.h | ||
39 | Would NullValue be correct? | |
53–54 | To be consistent between using mask versus arithmetic: !(Reg & VirtualRegFlag) && uint32_t(Reg) >= FirstSlackSlot; if you want better code from GCC or !(Reg & VirtualRegFlag) && uint32_t(Reg & ~VirtualRegFlag) >= FirstSlackSlot; if you want better code from Clang. | |
61 | Note: Number (and not bitmask) interpretation here. |
llvm/include/llvm/MC/MCRegister.h | ||
---|---|---|
39 | Used NoRegister to be consistent with what TableGen calls this value. |
- Address comments round 1
- Use numeric_limits for static assert
- Use bit mask interpretation for VirtualRegFlag
- Add range assert for index to virtual reg conversion
Please use numeric_limits