Unprocessed On stack Spilled
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Register Allocation via Graph Coloring

Compilers cannot give every variable its own physical register — CPUs only have a handful (K), while a function may juggle dozens of live values. The classic solution, due to Chaitin, models the problem as graph coloring: build an interference graph where virtual registers that are live at the same time are connected, then try to K-color it so connected registers get different physical registers. This simulator runs the real simplify/select algorithm — repeatedly stripping low-degree, guaranteed-colorable nodes onto a stack, optimistically spilling when none remain, then popping the stack and assigning the lowest free color — on a live 3D force-directed interference graph, so you can watch exactly which virtual registers get a physical register and which get spilled to memory as K, graph size, and density change.