PHI node generation

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.

Thanks,

Micah Villmow

Systems Engineer

Advanced Technology & Performance

Advanced Micro Devices Inc.

4555 Great America Pkwy,

Santa Clara, CA. 95054

P: 408-572-6219

F: 408-572-6596

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