The University of Arizona
banner image

  Code Specialization based on Value Profiles

Robert Muth   Scott Watterson   Saumya Debray
Department of Computer Science
University of Arizona
Tucson, AZ 85721, U.S.A.
 

Abstract
It is often the case that at runtime, variables and registers in programs are ``quasi-invariant,'' i.e., the distribution of the values they take on is very skewed, with a small number of values occurring most of the time. Knowledge of such frequently occurring values can be exploited by a compiler to generate code that optimizes for the common cases without sacrificing the ability to handle the general case. Since this involves the introduction of runtime tests, a careful cost-benefit analysis is necessary to make sure that the benefits from executing the code specialized for the common values outweigh the cost of testing for these values. This paper describes an implementation of value-profile-based code specialization within a link-time code optimizer.