Eliminating the call stack to save RAM

Update Item Information
Publication Type Manuscript
School or College College of Engineering
Department Computing, School of
Creator Regehr, John
Other Author Yang, Xuejun; Cooprider, Nathan
Title Eliminating the call stack to save RAM
Date 2009-01-01
Description Most programming languages support a call stack in the programming model and also in the runtime system.We show that for applications targeting low-power embedded microcontrollers (MCUs), RAM usage can be significantly decreased by partially or completely eliminating the runtime callstack. We present flattening, a transformation that absorbs a function into its caller, replacing function invocations and returns with jumps. Unlike inlining, flattening does not duplicate the bodies of functions that have multiple callsites. Applied aggressively, flattening results in stack elimination. Flattening is most useful in conjunction with a lifting transformation that moves global variables into a local scope. Flattening and lifting can save RAM. However, even more benefit can be obtained by adapting the compiler to cope with properties of flattened code. First, we show that flattening adds false paths that confuse a standard live variables analysis. The resulting problems can be mitigated by breaking spurious live-range conflicts between variables using information from the unflattened callgraph. Second, we show that the impact of high register pressure due to flattened and lifted code, and consequent spills out of the register allocator, can be mitigated by improving a compiler's stack layout optimizations. We have implemented both of these improvements in GCC, and have implemented flattening and lifting as source-to-source transformations. On a collection of applications for the AVR family of 8-bit MCUs, we show that total RAM usage can be reduced by 20% by compiling flattened and lifted programs with our improved GCC.
Type Text
Publisher Association for Computing Machinery
Dissertation Institution University of Utah
Language eng
Bibliographic Citation Yang, X., Cooprider, N., & Regehr, J. (2009). Eliminating the call stack to save RAM. In Proceedings of the ACM Conference on Languages, Compilers, and Tools for Embedded Systems (LCTES 2009). June.
Rights Management (c)Association for Computing Machinery: ACM, 2009. This is the authors version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution. The definitive version was published in Proceedings of the ACM Conference on Languages, Compilers, and Tools for Embedded Systems (LCTES 2009). June 19-20, Dublin, Ireland, p.1-10. http://doi.acm.org/10.1145/nnnnnn.nnnnnn. ACM 978-1-60558-356-3/09/06
Format Medium application/pdf
Format Extent 815,562 bytes
Identifier uspace,10541
ARK ark:/87278/s6wh37pr
Setname ir_uspace
ID 707572
Reference URL https://collections.lib.utah.edu/ark:/87278/s6wh37pr
Back to Search Results