An intermediate representation (IR) for quantum programs is a format, with defined syntax and semantics, that front ends (languages, circuit libraries) emit and back ends (compilers for specific devices, simulators) consume, so that languages and targets need translators rather than . Two open standards are widely used.
OpenQASM 3 (Cross et al.;
specification) is a textual language. Its gate semantics rest on
two built-in gates, the single-qubit and the global phase
; further gates are defined hierarchically or by modifiers such as
ctrl @, negctrl @ and inv @. Beyond circuits it adds classical types and arithmetic, branching
and loops on measurement results that must execute within the qubits' coherence time, subroutines and
extern calls, timing types (duration, stretch) with delay, box and barrier, and
defcal blocks that attach pulse-level implementations, in a selectable pulse grammar, to gates and
measurements on specific physical qubits. A gate definition fixes a unitary, not how the hardware
implements it.
QIR (specification) defines quantum programs as LLVM IR: qubits and results are opaque pointers, quantum operations are calls to functions of a quantum instruction set that the target chooses, and classical code is ordinary LLVM. Because targets differ widely, QIR defines profiles, coherent subsets that a back end declares it supports. The Base Profile requires only a sequence of quantum instructions followed by measurement of the qubits at the end; the Adaptive Profile adds mid-circuit measurement, conversion of results to booleans, and nested forward branching on them, with loops and further features as optional capabilities.
The two are complementary: OpenQASM 3 reads like an assembly language for circuits with real-time control, QIR reuses classical compiler infrastructure for analysis and optimisation.