Hi, I have couple of questions that those who design unconventional passes would be interested in. 1. How to move a virtual register data to another new virtual register? It seems like that there is no LLVM instruction similar to mov machine instruction. Arithmetic or logical operators could be used for integer variables but what about pointer variables? 2. What is typically IR-level pass execution order? Especially when we separately execute the front-end, IR optimizer, and back-end, this information seems to be needed. 3. In code generator, how can we add new instruction in a way that back-end consider this added instruction for its instruction scheduling and register allocation? Thanks in advance. - Keun Soo -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090118/6e539d74/attachment.html>
On Jan 17, 2009, at 10:27 PM, Keun Soo Yim wrote:> 1. How to move a virtual register data to another new virtual > register? > It seems like that there is no LLVM instruction similar to mov > machine instruction. > Arithmetic or logical operators could be used for integer variables > but what about pointer variables?Why do you need to copy a value? Virtual registers are immutable (SSA form), so you don't need to worry about the value getting overwritten.> 2. What is typically IR-level pass execution order? Especially > when we separately execute > the front-end, IR optimizer, and back-end, this information seems to > be needed.Take a look at tools/opt/opt.cpp. You can see what the "-std-compile- opts" sequence does in there. You can also look at tools/llvm-ld/ Optimize.cpp for a standard set of link-time optimizations. --Owen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090117/a99c1a0f/attachment.html>
Keun Soo Yim wrote:> > > > > Hi, > > > > I have couple of questions that those who design unconventional passes > would be interested in. > > > > 1. How to move a virtual register data to another new virtual > register? > > It seems like that there is no LLVM instruction similar to mov machine > instruction. > > Arithmetic or logical operators could be used for integer variables > > but what about pointer variables?The trick to copying values is to use bitcast where the source and destination types are the same. Of course, if you're doing this, you should understand that you're being very naughty indeed. :) Nick> > > > 2. What is typically IR-level pass execution order? Especially > when we separately execute > > the front-end, IR optimizer, and back-end, this information seems to be > needed. > > > > 3. In code generator, how can we add new instruction in a way that > back-end consider > > this added instruction for its instruction scheduling and register > allocation? > > > > Thanks in advance. > > > > - Keun Soo > > > > > > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Jan 17, 2009, at 10:27 PM, Keun Soo Yim wrote:> 3. In code generator, how can we add new instruction in a way > that back-end consider > this added instruction for its instruction scheduling and register > allocation? >You will want to add this in the appropriate .td file. The .td files are full of "recipes" which match nodes in the DAG. The appropriate instruction is selected from those recipes that match a pattern in the DAG. -bw