1. A computer implemented code generation method, comprising: a compiler generating a table of patterns, each pattern in the table comprising an FMA (fused multiply-add) DAG (Directed Acyclic Graph), a canonical form equivalent of the FMA DAG, and a shape corresponding to the canonical form equivalent; and matching a DAG representing incoming floating point expressions in a source code program received by the compiler against the patterns in the table of patterns during compilation of the program; the compiler generating a sequence of optimized FMA instructions to compute the floating-point expressions.