Brussels / 1 & 2 February 2014


An approach for energy consumption analysis of programs using LLVM

Energy models can be constructed by characterizing the energy consumed by executing each instruction in a processor's instruction set. This can be used to determine how much energy is required to execute a sequence of assembly instructions.

However, statically analyzing low level program structures is hard, and the gap between the high-level program structure and the low-level energy models needs to be bridged. We have developed a tool for performing a static analysis on the intermediate compiler representations of a program. Specifically, we target LLVM IR, a representation used by most modern compilers including Clang.

One of the challenges in doing so is that of determining an energy cost of executing LLVM IR program segments, for which we have developed a mapping tool. This tool associates LLVM IR program segments with assembly program segments, producing a mapping. Mapping information is useful when performing an analysis at one layer using energy models defined at a lower layer. Essentially, this propagates the energy model defined at the instruction set level up to the LLVM IR level, at which the analysis is performed. When this is used with our analysis tool, we are able to infer energy formulae that characterize the energy consumption for a particular program. This approach can be applied to any languages targeting the LLVM toolchain or architectures supported by LLVM.

Static energy estimation has applications in program optimization, and enables energy-aware software development.


Kerstin Eder
Kyriakos Georgiou
Neville Grech