Research indexJournal article
Optimal code generation for expression trees
Aho, Johnson
1 Jan 1975Open access
NobleIDark:/48914/w1/20260525/FE2ED3CFDOI10.1145/800116.803770
Optimal code generation for expression trees
Aho, Johnson · 1975
NobleIDark:/48914/w1/20260525/FE2ED3CFDOI10.1145/800116.803770
Abstract
We discuss the problem of generating code for a wide class of machines, restricting ourselves to the computation of expression trees. After defining a broad class of machines and discussing the properties of optimal programs on these machines, we derive a necessary and sufficient condition which can be used to prove the optimality of any code generation algorithm for expression trees on this class. We then present a dynamic programming algorithm which produces optimal code for any machine in the class; this algorithm runs in time which is linearly proportional to the number of vertices in an expression tree.