Rendering MachineFunctions as HTML.

Hi All,

I’ve developed a pass to render machine functions as HTML pages with some accompanying information about liveness and register pressure.

Current features:

Renders machine functions, optionally displaying estimated register pressure for selected register classes, and liveness for selected intervals.

The following command line options can be used to enable and customise the rendering:

-regalloc=pbqp -rmf-funcs= -rmf-classes= -rmf-intervals=

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).

is a coma seperated list of register classes to render pressure for (give their string names, such as GR32), or * to render all classes).

is a list of interval ranges to render. Each range can be one of the following:

  • : all intervals
    virt* : all virtual register intervals
    phys* : all physical intervals
    : the interval for register
    - : intervals for all registers in [start, end]

So an example invocation might look like:

llc -regalloc=pbqp -rmf-funcs=* -rmf-classes=GR8,GR16,GR32 -rmf-intervals=virt* -o s76t_info.s s76t_info.opt.bc

(Render all functions s76t_info.opt.bc in showing register pressure for GR8, GR16 and GR32, and showing live intervals for all virtual registers.)

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.

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.

Finally an acknowledgement: The machine function rendering project got started at AusHac2010 ( 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!



  • Better register pressure estimates.

  • Markers for where spilled intervals were defined/used.

  • Loop depth information.

  • Nicer rendering (syntax highlighted MachineInstrs?)

  • Reduce redundancy in HTML code (files are very big for large functions).

As per a request from Owen on IRC, and since I've managed to reduce
the output file sizes a bit, here is a example of the output from the
renderer for a simple function.


workfn.html (42.2 KB)