Search code examples
compiler-constructionregister-allocation

Building interference graph for register allocation


How can I build an interference graph so I may use it in register allocation? How do I determine live ranges?


Solution

  • Live ranges are usually detected with liveness analysis for basic blocks. Liveness analysis can be computed using dominance frontiers.

    A Simple, Fast Dominance Algorithm is a good read. I implemented both dominance and liveness analysis for a code analysis framework. You may have a look here and here.