[llvm-dev] Understanding SlotIndexes

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 25 07:54:01 PST 2016


On 12/22/2016 4:02 PM, via llvm-dev wrote:
>
>       /// Early-clobber register use/def slot.  A live range defined at
>       /// Slot_EarlyCLobber interferes with normal live ranges killed at
>       /// Slot_Register.  Also used as the kill slot for live ranges tied to an
>       /// early-clobber def.
>       Slot_EarlyClobber,
>
> What does this mean, exactly?  My impression was that an instruction
> uses a virtual register at Slot_EarlyClobber if it uses a register tied
> to a register def in that instruction.  Is that right?

Early clobber applies to a defined register and it prevents the register 
allocator from using it as an input register.


> My problem boils down to trying to find the defining instruction for a
> virtual register use.  Given an instruction using register A, I want to
> be able to look at the VNInfo at the instruction's register use slot and
> see what VNInfo::def points to.  Some scenarios I want to understand:
>
> 4B  A = ...
> 10B D = use A
>
> This seems straightforward.  The instruction at slot 10 uses A at 10r
> and the VNInfo for 10r should have a def at 4r.
>
> But that's not right!  I am staring at the following:
>
> LiveInterval: %vreg163 [5404r,6432B:0)[6480B,6688r:0)  0 at 5404r
> Instruction:  6688B %RDX<def> = COPY %vreg163

An instruction by itself doesn't have any meaningful slot.  It shows as 
B, but only because B is the default slot. For a given register you get 
the actual slot from the live interval.

-Krzysztof



More information about the llvm-dev mailing list