Current link-time optimization techniques can reduce the power consumption and code size of embedded software. Due to a lack of information, the stack frames of procedures are left untouched by link-time program optimizers. In this paper we present a practical whole-program linear-constant analysis that allows to analyze the stack layout of a procedure.
The analysis deals with the peculiarities of link-time program representation, namely the lack of high-level information and the huge size of the control flow graph. Even on a complete linux kernel, our analysis is practical in terms of computation time.
The collected information consists of restricted affine equations between two registers, but it enables optimizations complementary to existing link-time optimization techniques. On a set of ARM benchmarks, the number of store operations decreases by up to 7% while the execution time, program size and power consumption are all further improved.
This paper discusses both the practical issues of applying whole-program linear-constant propagation as well as its use in program optimization and understanding.