Repository logo

CoSense: Compiler Optimizations using Sensor Technical Specifications

Published version

Repository DOI


Conference Object

Change log


Mu, Pei 
Mavrogeorgis, Nikolaos 
Vasiladiotis, Christos 
Tsoutsouras, Vasileios 
Kaparounakis, Orestis  ORCID logo


Embedded systems are ubiquitous, but in order to maximize their lifetime on batteries there is a need for faster code execution – i.e., higher energy efficiency, and for reduced memory usage. The large number of sensors integrated into embedded systems gives us the opportunity to exploit sensors’ technical specifications, like a sensor’s value range, to guide compiler optimizations for faster code execution, small binaries, etc. We design and implement such an idea in COSENSE, a novel compiler (extension) based on the LLVM infrastructure, using an existing domain-specific language (DSL), NEWTON, to describe the bounds of and relations between physical quantities measured by sensors. COSENSE utilizes previously unexploited physical information correlated to program variables to drive code optimizations. COSENSE computes value ranges of variables and proceeds to overload functions, compress variable types, substitute code with constants and simplify the condition statements. We evaluated COSENSE using several microbenchmarks and two real-world applications on various platforms and CPUs. For microbenchmarks, COSENSE achieves 1.18× geomean speedup in execution time and 12.35% reduction on average in binary code size with 4.66% compilation time overhead on x86, and 1.23× geomean speedup in execution time and 10.95% reduction on average in binary code size with 5.67% compilation time overhead on ARM. For real-world applications, COSENSE achieves 1.70× and 1.50× speedup in execution time, 12.96% and 0.60% binary code reduction, 9.69% and 30.43% lower energy consumption, with a 26.58% and 24.01% compilation time overhead, respectively.



46 Information and Computing Sciences, 40 Engineering, 4009 Electronics, Sensors and Digital Hardware, 7 Affordable and Clean Energy

Journal Title

Proceedings of the 33rd ACM SIGPLAN International Conference on Compiler Construction

Conference Name

CC '24: 33rd ACM SIGPLAN International Conference on Compiler Construction

Journal ISSN

Volume Title


EPSRC (EP/V004654/1)