IT lexicon › Programming › PBQP register allocation

PBQP register allocation

Programming På svenska → Updated: 2026-11-06

A register allocator that frames the problem as cost minimisation over a graph, which makes it good at processors with irregular register rules.

Classic graph-colouring register allocation assumes all registers are interchangeable. That holds up poorly on DSPs and other quirky chips, where an instruction may only accept certain registers, or where two values get cheaper if they land in a register pair. In 2002 Bernhard Scholz and Erik Eckstein proposed treating allocation as a Partitioned Boolean Quadratic Problem: each value gets a cost vector over candidate registers, and each edge between two values a cost matrix describing how their choices interact.

The problem is NP-hard in general, but most nodes can be reduced away exactly, leaving only a remainder for heuristics. LLVM has shipped a PBQP allocator since 2008, selectable with -regalloc=pbqp. It sees little use on x86, where the greedy allocator is faster and nearly as good.

← Back to the lexicon