Re: Question about Sparse Linear form and pseudos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luc,

On 20 August 2017 at 16:15, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> On Sun, Aug 20, 2017 at 03:54:47PM +0100, Dibyendu Majumdar wrote:
>> I am trying to get to grips with the Sparse Linear format and the use
>> of pseudos.
>>
>> 1) A Sparse document says that pseudos are akin to SSA variables. Is
>> that a true statement - i.e. do pseudos follow the discipline that
>> only one assignment to a pseudo is allowed. As pseudos have also
>> different sub-types - does this statement apply to all pseudo types or
>> only some sub types?
>>
>> 2) In a recent conversation it was stated that the baseline Linear
>> output from Sparse is already in SSA form. That implies that all
>> pseudos used are in SSA form already. However we know that in the
>> baseline line IR phi nodes may not be present. In LLVM the initial IR
>> lacks phi nodes too - instead local stack memory and load/store
>> sequences are used. However LLVM IR is still SSA at this stage. When
>> it is said that the baseline Linear IR is already SSA is it in this
>> sense?
>
> One way to answer this with few words is to look at what's happening
> to a variable assigned in different paths in a simple example:

Thank you - it is always good to look at examples.

>
>         int f(void);
>
>         int foo(int p)
>         {
>                 int a;
>
>                 if (p) {
>                         a = 0;
>                         a++;
>                 } else {
>                         a = f();
>                 }
>
>                 return a;
>         }
>
>
> Just after linearization:
>         foo:
>         .L0:
>                 <entry-point>
>                 store.32    %arg1 -> 0[p]
>                 load.32     %r1 <- 0[p]
>                 cbr         %r1, .L1, .L2
>
>         .L1:
>                 store.32    $0 -> 0[a]
>                 load.32     %r2 <- 0[a]
>                 add.32      %r3 <- %r2, $1
>                 store.32    %r3 -> 0[a]
>                 br          .L3
>
>         .L2:
>                 call.32     %r4 <- f
>                 store.32    %r4 -> 0[a]
>                 br          .L3
>
>         .L3:
>                 load.32     %r5 <- 0[a]
>                 ret.32      %r5
>

Okay the linear output above seems SSA if we consider how it is shown
in the output. But in the code, access to 0[a] occurs via a pseudo -
of type PSEUDO_SYM. We see multiple stores happening to this pseudo.
So the question is each access generated through a different instance
of a pseudo? I see that in the code if a symbol already has a pseudo
then it is reused. So presumably then PSEUDO_SYMs are not SSA, but
PSEUDO_REGs are?

So then is it more accurate to say that PSEUDO_SYM and possibly
PSEUDO_ARG too - represent memory access, and are just a proxy for
stack allocated memory?

Regards
Dibyendu
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux