[LLVMdev] PHI node generation

Owen Anderson resistor at mac.com
Tue Sep 30 16:46:24 PDT 2008


On Sep 30, 2008, at 4:02 PM, Villmow, Micah wrote:

> I am running into an issue where phi nodes are generating move  
> instructions that are outside of the location where I want them to  
> be generated. The default generation method seems to be to put the  
> move instruction at the end of the preceding basic block related to  
> that specific phi node, but I need it to place the move before some  
> pseudo instructions that must be at the end of certain flow control  
> basic blocks. I’m looking at copyRegToReg as a possible location on  
> where to implement this modification, but I can’t figure out how to  
> determine if the origination of the move instruction to be generated  
> is from a PHI node or a normal move operation. Any help would be  
> useful in figuring this out.
>

What you're seeing is the standard naive approach to eliminating PHI  
nodes.  There isn't a way to detect where the copy came from, unless  
you're planning to replace the PHI elimination pass.  As an  
alternative suggestion:  how about having a pass that inserts you  
special instructions, which is run _after_ PHI elimination?

--Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080930/57b4f060/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080930/57b4f060/attachment.bin>


More information about the llvm-dev mailing list