Forms and program meaning

A compiler can build a syntax tree, generate an intermediate representation, transform it, and then select target instructions. The representation is working material for compilation rather than necessarily a user-facing language.

LLVM uses a typed low-level representation with static single assignment values. Its in-memory structures, bitcode files and readable assembly form describe the same representation; the readable form is not a particular processor’s assembly language.

References: [2] [3]

Lowering expressions

GCC’s GIMPLE breaks complicated expressions into simpler three-address operations, introducing temporary values when needed. For side-effect-free a + b × c, a multiplication result can become an operand of a later addition; language evaluation rules still constrain transformations.

Lowering can remove high-level control structures or lexical-scope information. A representation close to the source and one close to instructions serve different passes, so a compiler may use several levels.

References: [1]

Construction and correctness

LLVM’s tutorial generates instructions from syntax-tree nodes by first generating operands and then constructing operations. Operand and result types constrain those instructions; readable temporary names mainly assist inspection.

Parsing alone does not establish correctness. LLVM also checks conditions such as definitions dominating their uses. These checks expose malformed transformations, but an intermediate representation does not itself prove that every optimization preserves program behavior.

References: [2] [3]