[llvm-dev] LiveRegUnits vs LivePhysRegs

Matthias Braun via llvm-dev
Tue, 02 Nov 2021 23:12:18 -0000

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

- Matthias

> On Nov 2, 2021, at 12:08 PM, Quentin Colombet via llvm-dev <llvm-dev at
lists.llvm.org> wrote:
>
> 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.
>
>> On Nov 2, 2021, at 4:51 AM, Jay Foad via llvm-dev <llvm-dev at
lists.llvm.org> wrote:
>>
>> 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
>> stepBackward.
>>
>> Thanks,
>> Jay.
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev