Look ma, no hashing, and no arrays neither

Jiazhen Cai, Robert Paige

1991 · 27 citations · 19 references

DOIFull text

Open access

Concepts

Abstract

It is generally assumed that hashing is essential to many algorithms related to efficient compilation; e.g., symbol table formation and maintenance, grammar manipulation, basic block optimization, and global optimization. This paper questions this assumption, and initiates development of an efficient alternative compiler methodology without hashing or sorting. Underlying this methodology are several generic algorithmic tools, among which special importance is given to Multiset Discrimination, which partitions a multiset into blocks of duplicate elements. We show how multiset discrimination, together with other tools, can be tailored to rid compilation of hashing without loss in asymptotic performance. Because of the simplicity of these tools, our results maybe of practical as well as theoretical interest. The various applications presented culminate with a new algorithm to solve iterated strength reduction folded with useless code elimination that runs in worst case asymptotic time and auxiliary space linear in the maximum text length of the initial and optimized programs. 1. Introduction. with linear search time and a hash table. They also pro-An important practical and theoretical question in Computer Science is whether there are algorithms whose worst case performance can match the expected performance of solutions that utilize hashing. In the context of this broader question, we initiate an investigation of efficient compilation without hashing and, consequently, raise some doubts about the prevailing view that hashing (e.g., universal hashing [5]) is essential to the various aspects of compilation from symbol table management [2] to reduction in strength by hashed temporaries [6]. Aho, Sethi, and Unman [2] present only two data structures for storing symbol tables -a linear linked list pose these two data structures for methods to turn an expression tree into a dag and the more general basic block optimization of value numbering. Hashing is involved in preprocessing for global optimization to perform constant propagation [22], global redundant code elimination [4], and code motion [8]. The best methods of strength reduction [3,6] rely on hashed temporaries to obtain efficient implementations. There are several reasons why hashing is used in these applications. Hashing has O(1) expected time performance and Iincar auxiliary space. The method of Universal Hashing, due to Carter and Wegman [5], is especially desirable, since the expected O(1) time is independent of the input distribution. Universal hashing is well suited to applications such as compilation, where the hash tables do not persist beyond a single compilation run. In the applications mentioned above hashing leads to

References

19