IT lexicon › Programming › Instruction scheduling

Instruction scheduling

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

The compiler reorders instructions, without changing the result, so the processor doesn't sit waiting on slow operations.

A memory load can take several cycles before its value arrives. Put a few independent instructions between the load and its use and the pipeline has something to do in the meantime. The standard technique is list scheduling: build a graph of which instructions depend on which, and each cycle pick the ready instruction sitting on the longest remaining chain.

It fights with register allocation. Spreading dependent instructions apart stretches value lifetimes and needs more registers; packing them tight saves registers but causes stalls. That's why scheduling often runs both before and after allocation. How much it matters depends on the hardware: Itanium and other VLIW designs lived or died by the compiler's schedule, while out-of-order cores do much of the work themselves.

← Back to the lexicon