PHI nodes

Hello,

I am trying to write a LLVM backend for a school project using only
custom code (as with the CBackend) and I'm having difficulties
handling the PHI nodes from LLVM asm code. Is there any pass we can do
before my custom Module Pass to remove the PHI nodes?

Pedro Ferreira wrote:

Hello,

I am trying to write a LLVM backend for a school project using only
custom code (as with the CBackend) and I'm having difficulties
handling the PHI nodes from LLVM asm code. Is there any pass we can do
before my custom Module Pass to remove the PHI nodes?

Try the Reg2Mem pass. http://llvm.org/docs/Passes.html#reg2mem

Nick

Nick Lewycky <nicholas <at> mxc.ca> writes:

Pedro Ferreira wrote:
> Hello,
>
> I am trying to write a LLVM backend for a school project using only
> custom code (as with the CBackend) and I'm having difficulties
> handling the PHI nodes from LLVM asm code. Is there any pass we can do
> before my custom Module Pass to remove the PHI nodes?

Try the Reg2Mem pass. http://llvm.org/docs/Passes.html#reg2mem

Nick

Interesting, didn't know about that one. That node however introduces wierd
instructions on the code.
Although i think it might be easier if we could prevent the generation of such
nodes. Is there any specific option we can use?

Nick Lewycky <nicholas <at> mxc.ca> writes:

Pedro Ferreira wrote:

Hello,

I am trying to write a LLVM backend for a school project using only
custom code (as with the CBackend) and I'm having difficulties
handling the PHI nodes from LLVM asm code. Is there any pass we can do
before my custom Module Pass to remove the PHI nodes?

Try the Reg2Mem pass. http://llvm.org/docs/Passes.html#reg2mem

Nick

Interesting, didn't know about that one. That node however introduces wierd
instructions on the code.

What do you mean by weird instructions?

Although i think it might be easier if we could prevent the generation of such
nodes. Is there any specific option we can use?

No. If there was, it would look like the output of Reg2Mem anyways.

-Tanya