Related articles |
---|
SSA construction and aliased variables sergey@solyanik.com (Sergey Solyanik) (1998-01-17) |
Re: SSA construction and aliased variables kistler@ics.uci.edu (Thomas Kistler) (1998-01-17) |
Re: SSA construction and aliased variables felix@mamba.pond.sub.org (1998-02-08) |
From: | felix@mamba.pond.sub.org (Felix Schroeter) |
Newsgroups: | comp.compilers |
Date: | 8 Feb 1998 13:34:13 -0500 |
Organization: | Chaos |
References: | 98-01-067 |
Keywords: | analysis, question |
Sergey Solyanik <sergey@solyanik.com> wrote:
>[...]
>However, if the code is
>
>if (a)
> {
> p = 1;
> }
>else
> {
> p = 2;
> function_call();
> }
In one compiler using SSA form I know [1], this would be roughly translated
to the following:
r0: REGION(ref to all predecessor basic blocks) # basic block for if test
t0: READ(m0, a) # m0 is the initial memory state, from which a is read
t1: CONV_b(t0) # convert to boolean
t2: COND(t1) [r0] # conditional jump, pinned to region r0
t3: PROJ_f(t2) # control flow for "false"
t4: PROJ_t(t2) # control flow for "true"
r1: REGION(t4) # true branch
t5: CONST(1)
m1: WRITE(m0, p, t5) [r1]
t6: JMP # jump after the conditional - the target is determined by
# the reference in REGION
r2: REGION(t3) # false branch
t7: CONST(2)
m2: WRITE(m0, p, t7) [r2]
t8: CALL(m2, function_call) # parameters would follow "function_call"
m3: PROJ_m' (t8) # t8 is a tupel of new memory state and the result value(s)
t9: JMP # after the conditional
r3: REGION(t6, t9) # code after the conditional
m4: PHI(m1, m3) # new memory state
now an access to p would generate a statement like
t10: READ(m4, p)
Hope that helps a bit :-)
Regards, Felix.
[1] Fiasco, to be found at
http://i44www.info.uni-karlsruhe.de/sather/index_engl.html
Fiasco is the result of a diploma thesis about
the design and implementation of a Sather-K compiler
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.