<div class="gmail_quote">On Sun, Aug 15, 2010 at 10:04 PM, Jakob Stoklund Olesen <span dir="ltr"><<a href="mailto:stoklund@2pi.dk" target="_blank">stoklund@2pi.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><br>
On Aug 15, 2010, at 5:12 PM, Silvio Ricardo Cordeiro wrote:<br>
<br>
> Is there a way for me to collect statistics about the number of loads/stores added by the "linearscan" register allocator (just like can be done with the "local" allocator)?  I still haven't grokked very well the interaction between RALinScan and Spiller... Should I add those two statistics to the spiller's class?<br>



<br>
</div>RALinearScan asks the Spiller to spill a virtual register. The StandardSpiller passes the request to LiveIntervals::addIntervalsForSpills. Here, the spill and restore points are added to the VirtRegMap. No spill code has been inserted yet. After register allocation completes, VirtRegRewriter inserts the store and load instructions specified in VirtRegMap.<br>



<br>
The counters you are looking for are in VirtRegRewriter.cpp.<br></blockquote><div><br></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">I compiled "sort.c" from coreutils8.5 using both <i>local</i> and <i>linearscan</i> allocators (I'm using LLVM 2.7). For <i>local</i>, I get a Load/Store count of 314/367. But when I use <i>linearscan</i>, the counters at VirtRegRewriter.cpp end up being 0/0. I've also tried to compile a couple other source files, and </span><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">VirtRegRewriter.cpp always has NumLoads=0 and NumStores=0 in the end.</span></div>


<div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br></span></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">I can't believe linearscan is <i>that </i>good! I've tried to add other variables to the source code, but it seems to be spiling them without updating NumLoads/NumStores...</span></div>


<div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br></span></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Is there a source file that's commonly used to test this kind of thing?</span></div>


<div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br></span></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



We are working on simplifying this for obvious reasons. If you specify -spiller=inline, the InlineSpiller will insert loads and stores immediately. There are currently no statistics counters in InlineSpiller.cpp. Feel free to add some.<br>


</blockquote><div><br></div><div>Hmmm yeah, but that's not available for LLVM 2.7, so no luck (although I may try to "adapt" it for 2.7 if I need to).</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<font color="#888888">
/jakob<br><font color="#000000"><font color="#888888"><br></font></font></font></blockquote></div><br>-- <br>Silvio Ricardo Cordeiro<br>