<br><br>
<div><span class="gmail_quote">On 4/3/07, <b class="gmail_sendername">David Greene</b> <<a href="mailto:greened@obbligato.org">greened@obbligato.org</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Toward a better register allocator, I'm attempting to understand<br>the dataflow information available to the allocator.
<br><br>What's the difference between LiveInterval information and LiveVariable<br>information?  If a LiveInterval is based on a linear ordering of<br>the machine instructions, isn't it rather conservative in nature?
<br><br>Let's say I have a typical diamond CFG:<br><br>                A<br>               / \<br>              B   C<br>               \ /<br>                D<br><br>Now, suppose variable "x" is defined in block A and used in block
<br>B, after which it is dead.  Suppose also that variable "y" is defined<br>and used in block C, after which it is dead.<br><br>A traditional live variable analysis would say that x and y do not<br>interfere.  However, what happens if the linear ordering of
<br>instructions puts block C before block B?  Then it seems to me<br>that the live intervals overlap and we'd see a false interference.<br><br>Does the ability of LiveIntervals to have holes in them take care<br>of this problem?  Let's say block A has instructions 1-10, block
<br>C 11-20 and block B 21-30 and that x is defined at instruction 1<br>and last used at instruction 30.  Let's say y is defined at<br>instructions 11 and last used at instruction 20<br><br>What do the LiveIntervals look like?
<br><br>x: [1-10] [21-30]  y: [11-20]  =>  No interference<br>x: [1-30]          y: [11-20]  =>  False interference<br>x: Something else? y: [11-20]<br><br>                                   -Dave<br><br>_______________________________________________
<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></blockquote>
<div> </div>
<div>AFAIK, LiveVariables analysis pass (from $LLVMSRCDIR/lib/CodeGen/LiveVariables.cpp) is used and improved by LiveIntervals analysis (lies in the same directory).</div>
<div>LiveIntervals analysis handles the false interference case (you've shown above). You can read about the idea from the paper by Alkis Evlogimenos: <a href="http://llvm.org/ProjectsWithLLVM/2004-Fall-CS426-LS.pdf">
http://llvm.org/ProjectsWithLLVM/2004-Fall-CS426-LS.pdf</a>.</div>
<div>I think the current linearscan implementation of LLVM is based on the same paper, too. If you want to develop a register allocator for LLVM, the RegAllocLinearScan.cpp should be the best place to start learning LLVM from. linearscan gives the best results among LLVM's allocators so it also should be the first allocator to compete with :)
</div><br>If you think about better register allocator I'd suggest you to look at <a href="http://citeseer.ist.psu.edu/kong98precise.html">http://citeseer.ist.psu.edu/kong98precise.html</a> and find a paper of Sid-Ahmed-Ali Touati named "Register Saturation in Instruction Level Parallelism". These works propose faster and better algorithms than graph coloring, at least as I understand it.
</div>
<div> </div>
<div>Best regards,</div>
<div>Anton.</div>