Some Global Optimizations for a Prolog Compiler

This paper puts forward the suggestion that many PROLOG programs are not radically different in kind from programs written in conventional languages. For these programs, it should be possible for a PROLOG compiler to produce code of similar efficiency to that of other compilers. Moreover, there is no reason why reasonable efficiency should not be obtained without special-purpose hardware. Therefore, at the same time as pursuing the goal of special hardware for running PROLOG programs, we should be looking at how to maximize the use of conventional machines and to capitalize on developments in conventional hardware. It seems unlikely that conventional machines can be efficiently used by PROLOG programs without the use of sophisticated compilers. A number of possible optimizations that can be made on the basis of a static, global analysis of programs are presented, together with techniques for obtaining such analyses. These have been embodied in working programs. Timing figures for experimental extensions to the POPLOG PROLOG compiler are presented to make it plausible that such optimizations can indeed make a difference to program efficiency.