This is an archive of the discontinued LLVM Phabricator instance.

[MC] Remove MCRegisterClass::getSize
AbandonedPublic

Authored by craig.topper on Aug 3 2018, 5:04 PM.

Details

Reviewers
kparzysz
Summary

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?

Diff Detail

Event Timeline

craig.topper created this revision.Aug 3 2018, 5:04 PM
bjope added a subscriber: bjope.Aug 5 2018, 11:50 AM

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.

bogner added a subscriber: bogner.Aug 10 2018, 12:51 AM

What exactly are out of tree targets supposed to migrate to?

bjope added a comment.Aug 10 2018, 1:39 AM

What exactly are out of tree targets supposed to migrate to?

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).

craig.topper abandoned this revision.Aug 10 2018, 11:07 AM

Abandoing since this was removed as part of the superset https://reviews.llvm.org/D47199