linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dibyendu Majumdar <mobile@majumdar.org.uk>
To: Christopher Li <sparse@chrisli.org>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Question about Sparse Linear form and pseudos
Date: Sun, 20 Aug 2017 17:18:56 +0100	[thread overview]
Message-ID: <CACXZuxf7jN5JTPhDbgDPPW-7wtWAQG5-4Ec0x9U4Y3Cv3ofZnw@mail.gmail.com> (raw)
In-Reply-To: <CANeU7Qm5nqDNKy05+iZMKtDiBKMueqfnqsw+b6BVysMQBP-eLQ@mail.gmail.com>

Hi Chris,

On 20 August 2017 at 16:44, Christopher Li <sparse@chrisli.org> wrote:
> On Sun, Aug 20, 2017 at 10:54 AM, Dibyendu Majumdar
> <mobile@majumdar.org.uk> 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?
>
> The pseudo should be SSA, it apply to all types of pseudo.
> You can thing of pseudos are similar to LLVM virtual registers.
>

I am wondering if this is true - please see my reply to Luc. In
particular it seems that stores to local variables are represented by
PSEUDO_SYMs and multiple assignments can occur to these. Hence the
PSEUDO_SYMs and probably PSEUDO_ARGs too are not SSA?

>>
>> 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?
>
> There are two different things happen here. For the IR that is
> generated from linearizing, without the simplification, all the pseudo
> is already SSA. It does not need phi node because all the internal
> usage of the pseudo already dominated by the pseudo defines.
>
> There is a separate phase, in simplify symbol access, will try to promote
> the memory load/store into the SSA pseudo registers. That is where
> the phi nodes come it.
>
> LLVM is similar in that regard. The very first batch of the byte code
> contain raw load/store on memory variables. You will not see the SSA
> on the memory variable. Then there is a pass call "promote memory
> to scalar". In this pass it will convert the memory access into SSA
> virtual registers.
>

Agreed - however there is one difference it seems. LLVM explicits
outputs alloca instructions for each memory location - and then does
store/load on these. In Sparse though, a sub type of pseudo -
PSEUDO_SYM is used for the same, right?

Regards
Dibyendu

      reply	other threads:[~2017-08-20 16:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-20 14:54 Question about Sparse Linear form and pseudos Dibyendu Majumdar
2017-08-20 15:15 ` Luc Van Oostenryck
2017-08-20 16:12   ` Dibyendu Majumdar
2017-08-20 16:20     ` Linus Torvalds
2017-08-20 16:26       ` Dibyendu Majumdar
2017-08-20 16:33         ` Linus Torvalds
2017-08-20 16:45           ` Luc Van Oostenryck
2017-09-07  2:22             ` Luc Van Oostenryck
2017-08-20 16:50           ` Dibyendu Majumdar
2017-08-20 18:22           ` Christopher Li
2017-08-20 16:20     ` Christopher Li
2017-08-20 16:40       ` Dibyendu Majumdar
2017-08-20 15:44 ` Christopher Li
2017-08-20 16:18   ` Dibyendu Majumdar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACXZuxf7jN5JTPhDbgDPPW-7wtWAQG5-4Ec0x9U4Y3Cv3ofZnw@mail.gmail.com \
    --to=mobile@majumdar.org.uk \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).