<div>Hi All,</div><div><br></div><div>I've developed a pass to render machine functions as HTML pages with some accompanying information about liveness and register pressure.</div><div><br></div><div>Current features:</div>


<div><br></div><div>Renders machine functions, optionally displaying estimated register pressure for selected register classes, and liveness for selected intervals.</div><div><br></div><div>The following command line options can be used to enable and customise the rendering:</div>


<div><br></div><div><font face="'courier new', monospace">-regalloc=pbqp -rmf-funcs=<function list> -rmf-classes=<class list> -rmf-intervals=<interval list></font></div>
<div><br></div><div><function list> is a coma seperated list of functions to render, or * to render all functions in the module (each will be output to its own html file).</div>
<div><br></div><div><class list> is a coma seperated list of register classes to render pressure for (give their string names, such as GR32), or * to render all classes).</div><div><br></div><div><interval list> is a list of interval ranges to render. Each range can be one of the following:</div>

<div><font face="'courier new', monospace">           *  </font>: all intervals</div><div><font face="'courier new', monospace">        virt* </font>: all virtual register intervals</div>
<div><font face="'courier new', monospace">        phys* </font>: all physical intervals</div><div><font face="'courier new', monospace">        <reg> </font>: the interval for register <reg></div>

<div><font face="'courier new', monospace"><start>-<end> </font>: intervals for all registers in [start, end]</div><div><br></div><div>So an example invocation might look like:</div>
<div><br></div><div><font face="'courier new', monospace">llc -regalloc=pbqp -rmf-funcs=* -rmf-classes=GR8,GR16,GR32 -rmf-intervals=virt* -o s76t_info.s s76t_info.opt.bc</font></div>
<div><br></div><div>(Render all functions s76t_info.opt.bc in showing register pressure for GR8, GR16 and GR32, and showing live intervals for all virtual registers.)</div><div><br></div><div>By using the options above to narrow the rending to the things you're interested in (or turning everything on to get a big picture), you can gain a bit of insight into what the compiler is doing with your function.</div>
<div><br></div><div>There's still plenty to be done (see postscript for suggestions), but it's stable enough to be worth checking out, if you're in to this kind of thing. Feedback and suggestions very welcome.</div>

<div><br></div><div>Finally an acknowledgement: The machine function rendering project got started at AusHac2010 (<a href="http://www.haskell.org/haskellwiki/AusHac2010" target="_blank">http://www.haskell.org/haskellwiki/AusHac2010</a>) due to strong interest in LLVM's register allocator from several GHC LLVM backend hackers. Many thanks to Alex Mason and Ivan Miljenovic for organising such a great event, and to all the other attendees for making it a really enjoyable weekend!</div>


<div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div><div><br></div><div>TODO:</div><div><div><div><br></div><div>* Better register pressure estimates.</div></div><div>* Markers for where spilled intervals were defined/used.</div>

<div>* Loop depth information.</div><div>* Nicer rendering (syntax highlighted MachineInstrs?)</div><div>* Reduce redundancy in HTML code (files are very big for large functions).</div></div><div><br></div>