Re: Transforms on SSA form

2008-12-05 Thread James Courtier-Dutton
2008/12/4 Diego Novillo <[EMAIL PROTECTED]>: > On Thu, Dec 4, 2008 at 11:20, John Freeman <[EMAIL PROTECTED]> wrote: >> There are documented methods of SSA decomposition. The naive method is a >> simple reversal of SSA composition: >> >> SSA composition: rename variables (typically by adding suffi

Re: Transforms on SSA form

2008-12-04 Thread Diego Novillo
On Thu, Dec 4, 2008 at 11:20, John Freeman <[EMAIL PROTECTED]> wrote: > There are documented methods of SSA decomposition. The naive method is a > simple reversal of SSA composition: > > SSA composition: rename variables (typically by adding suffix), add phi > nodes > SSA decomposition: rename var

Re: Transforms on SSA form

2008-12-04 Thread Diego Novillo
2008/12/3 James Courtier-Dutton <[EMAIL PROTECTED]>: > Example C code: > a = 1; > if (condition) a = 2; > b = a; > > In SSA (use $ for the Phi, Φ) > a1 = 1; > if (condition) a2 = 2; > a3 = $(a1, a2); > b1 = a3; > > My problem is how do I convert the "a3 = $(a1, a2);" back to normal C code? Try u

Re: Transforms on SSA form

2008-12-04 Thread John Freeman
There are documented methods of SSA decomposition. The naive method is a simple reversal of SSA composition: SSA composition: rename variables (typically by adding suffix), add phi nodes SSA decomposition: rename variables (by dropping suffix), remove phi nodes The short answer to your quest

Re: Transforms on SSA form

2008-12-03 Thread Duncan Sands
Hi, > I am looking to transform a tree in SSA form into a representation of it in C. you can try using LLVM (which uses an IR in SSA form): it has a "C" backend that squirts out C equivalent to the IR. The resulting C is not very nice to read though. Ciao, Duncan. PS: This is a cute way of ge

Transforms on SSA form

2008-12-03 Thread James Courtier-Dutton
Hi, I am looking to transform a tree in SSA form into a representation of it in C. Example C code: a = 1; if (condition) a = 2; b = a; In SSA (use $ for the Phi, Φ) a1 = 1; if (condition) a2 = 2; a3 = $(a1, a2); b1 = a3; My problem is how do I convert the "a3 = $(a1, a2);" back to normal C cod