I'm working on a target for the intermediate language of another compiler, and the other compiler does it's own register allocation.  In the other imediate language, the pseudo-registers are not live across basic blocks; Anything value that is live accross basic blocks should be put on the stack frame, and when the other compiler's register allocation occurs it will be taken back out of the stack frame.  <br>
<br>In case it helps answer my question, the code I'm working on is a modified copy of the MIPS target, because it looked like it would be easier to modify the MIPS target than to start from scratch.  Right now the project is being developed on LLVM 3.1.<br>
<br>So here's the question. From the looks of it, I need to write a pass that looks through the basic blocks, finds any registers that get written, checks if they get used in other blocks (before being written to again), and if so, inserts the necessary loads and stores.  Is there a better way to do this?  If not, what would be the best place do this pass?<br>
<br>Thanks,<br><br>Ryan<br>