Why do we have both LiveRegUnits and LivePhysRegs? They seem to do
the same job of tracking physical register liveness at RegUnit
granularity. The only difference I have noticed is that LivePhysRegs
provides both stepForward and stepBackward, but LiveRegUnits only has
Take it with a grain of salt, Matthias may remember better, but I think that’s just an historical quirk that some client didn’t want to deal with with regunit.
One tracks registers, the other tracks register units. Unfortunately that is not 100% the same thing. Traditionally we only assigned register units in cases where the registers can be addressed separately. I.e. on X86 we will end up with register units for 8bit low/high registers because ah/al can be used independently of each other, while we won't end up with a unit for the upper 16bit, because there is only %ax and %eax (but nothing like a %hax or whatever you would call bits 16-32...).
As far as I know, this system broken down when it came to ABIs, because the windows ABI only guarantees to preserve XMM but not YMM. Unfortunately we do not have a register unit to express the difference and so we end up call clobber operands being specified in physical registers rather than register units. And depending on whether you need to handle these call-clobber situations you may need one or the other...
I think we had talk in the past of maybe forcing the creation of register units for the XMM/YMM difference, but there's no code and we have no idea if that has a big impact on regally times etc...
Thanks. I had not appreciated those differences between registers and regunits.