[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [language-experts] SSA like notation on a simple AST
From: |
Bruno Haible |
Subject: |
Re: [language-experts] SSA like notation on a simple AST |
Date: |
Thu, 29 Mar 2012 11:33:38 +0200 |
User-agent: |
KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; ) |
Hi Paulo,
> The SSA like notation should make it easy to picture what is being done, and
> make it easier to figure out if in a loop, if there is a jump, e.g. goto, etc.
>
> A simple example could be represented as:
>
> void t(c#0) {
> auto a#0, b#0;
>
> for (a#1 = b#1 = 0; a#2 < c#0; a#2++)
> b#2 += a#2;
>
> print("%d\n", b#3);
> }
You mean this notation should be used by a programmer? Or do you only
mean to indicate the internal representation of the compiler or
interpreter?
In any case, I don't see how an operator '++' can apply here. Don't you
need to resolve operator '++' first? So that you get
a#3 = a#2 + 1
SSA is helpful for register allocation, range propagation, and similar
optimizations [1]. If your compiler is doing these kinds of optimizations,
SSA can help.
Bruno
[1] http://en.wikipedia.org/wiki/Static_single_assignment_form