[LLVMdev] Is it possible to use the SimpleRegisterCoalescing pass in an iterative way?

Roman Levenstein romix.llvm at googlemail.com
Fri Jan 9 01:36:15 PST 2009


Hi,

I'm implementing some variations of graph-coloring register allocators for LLVM.
Many of them perform their phases (e.g. coalescing, graph
simplification, spilling,  color selection) in an iterative way. Since
LLVM provides an implementation of the coalescing in the
SimpleRegisterCoalescing class already, I would like to reuse it (even
though I could of course create my own coalescing implementation). But
this class is a MachineFunctionPass.

I'm wondering, if it is possible to use this pass from another pass
(i.e. regalloc) in an iterative way:
I need to invoke it multiple times for the same MachineFunction at
certain places in my regalloc pass implementation.
May be some sort of analysis update can be performed? Or is it
designed to be used just once per MachineFunction?

Also overall, it would be interesting to know how LLVM supports such
kind of iterative algorithms? What are the ways to formulate the
independent phases of those algorithms as reusable passes that could
be used in an iterative way?

Thanks,
-Roman



More information about the llvm-dev mailing list