ryan baird
2012-Sep-15 16:00 UTC
[LLVMdev] Best way to generate Pseudo-Registers in target language?
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. 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. 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? Thanks, Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120915/0486922e/attachment.html>
Roel Jordans
2012-Sep-17 11:10 UTC
[LLVMdev] Best way to generate Pseudo-Registers in target language?
It sounds like you want the effects of the -reg2mem pass http://llvm.org/docs/Passes.html#reg2mem - Roel On 15/09/12 18:00, ryan baird wrote:> 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. > > 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. > > 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? > > Thanks, > > Ryan