IT lexicon › Programming › Two-address instruction

Two-address instruction

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

An instruction whose destination doubles as one of its sources, so add eax, ebx overwrites one operand with the result.

A compiler's intermediate representation is nearly always three-address: c = a + b, three free names. x86, which inherited its format from the 8086, can only say a = a + b. If a is needed again afterwards, the compiler has to copy it first. LLVM has a dedicated pass that inserts those copies before register allocation, after which coalescing tries to delete as many of them as it can.

The classic workaround is lea, the address-calculation instruction, which happens to add two registers into a third without touching either. AVX gave floating-point instructions a three-operand form through VEX encoding in 2011, and Intel's APX extension from 2023 does the same for integers. So it took about forty years to lift a restriction the RISC designs never had.

← Back to the lexicon