[LLVMdev] Getting rid of phi instructions?

Michael Ilseman michael at lunarg.com
Wed Aug 31 13:32:42 PDT 2011


>  the next tool reading the IR does not like phis when it's generating VHDL.

If you're doing a conversion from LLVM IR to some other non-SSA IR
(like the tool's), you can do the phi node removal yourself as you
convert. Basically, every predecessor block referenced by a phi node
will have an assignment to that variable before branching. There are
techniques to make the resultant code more efficient, see Cytron et
al.[1].

[1] "Efficiently computing static single assignment form and the
control dependence graph"
http://www.eecs.umich.edu/~mahlke/583w03/reading/cytron_toplas_91.pdf

On Wed, Aug 31, 2011 at 2:06 AM, Teemu Rinta-aho
<teemu.rinta-aho at nomadiclab.com> wrote:
> On 30.8.2011, at 19.19, Eli Friedman wrote:
>
>> reg2mem won't do quite this transformation... not sure exactly what you need.
>
> I need to get rid of phis. This code is compiled from C++ and for some functions
> there are no phis, but multiple call instructions. I am targeting hardware
> in the end, and the next tool reading the IR does not like phis when it's generating VHDL.
> My questions may be somewhat silly from the viewpoint of software compilation for a CPU.
>
> Thanks.
>
> Teemu
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list