[Mesa-dev] [RFC 7/9] nir/nir: Use a linked list instead of a has set for use/def sets

Jason Ekstrand jason at jlekstrand.net
Mon Apr 27 14:25:27 PDT 2015


On Mon, Apr 27, 2015 at 1:35 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:
> On Fri, Apr 24, 2015 at 7:32 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>> +struct nir_if;
>> +
>>  typedef struct nir_src {
>>     union {
>> +      nir_instr *parent_instr;
>> +      struct nir_if *parent_if;
>> +   };
>
> There's something I'm not quite understanding about this... how are we
> supposed to know which of parent_instr and parent_if are valid? If I
> walk over all the sources for a given SSA def or register, how am I
> supposed to know if it's part of an if-condition or an instruction? I
> would think that you would need a boolean here or have parent_instr
> and parent_if not be in a union.

We do the same thing we did with the sets before.  We have separate
uses and if_uses sets.  If it's in if_uses, you use the if.  If it's
in uses, it's an instr.  We could put something in the source but that
seems like it'll make for even more mess.
--Jason


More information about the mesa-dev mailing list