There is a comment that says this method is temporary to allow out of tree targets to migrate. It's been over a year and we just branched for 8.0. Is now a good time to remove it?
Details
Diff Detail
Event Timeline
I think that it is about time to at least remove MCRegisterClass::getSize().
Notice that I also suggested to remove getPhysRegSize() (and the PhysRegSize member) in https://reviews.llvm.org/D47199, but it is perhaps more controversial to remove the register size completely from MCRegisterClass?
Afaik there is not in-tree use of getPhysRegSize(). And making it possible to get the size in bytes of a reg class with non-byte-sized registers, without telling that it truncates down to whole bytes, might be a little bit confusing (e.g. getPhysRegSize() for a register class with 1-bit registers will return 0).
I agree with Bjorn: both getSize and getPhysRegSize were not meant to be there. They were added because getting rid of them caused some OOT failures. That was a while back, so maybe they are no longer used. I'm all in favor of removing them, maybe we should just go ahead with it and see if anyone complains. I accepted D47199 since it contains the larger change.
If you have access to TRI, then TargetRegisterInfo::getRegSizeInBits() or TargetRegisterInfo::getSpillSize() are common options.
The old MCRegisterClass::getSize() was about spill size (it was the result of taking the SpillSize attribute in tablegen register class definitions and dividing it by 8).
With TRI you are able to choose between register size (in bits) or spill size (in bytes).
(well, the spill size is actually in octets for OOT targets like ours that has a byte size of 16...)
If you can't use TRI, then one solution is to revert https://reviews.llvm.org/rL339350 in you repo and maintain the old interface yourself. We've been maintaining the removal of these methods in our OOT repo for a long time, because if someone started to use those methods in-tree, in non-target-specific code, it could result in new miscompiles every time we merged from trunk (since the result from these methods are wrong for non-byte-sized registers).
Abandoing since this was removed as part of the superset https://reviews.llvm.org/D47199