Traceability of Flow Information: Reconciling Compiler Optimizations and WCET Estimation

Real-time systems have become ubiquitous. For this class of systems, correctness implies not only producing the correct result, but also doing so within specified timing constraints. Designers are required to obtain the worst-case execution time (WCET) of their systems to guarantee that all applications meet their time constraints. Many WCET estimation methods have been proposed. They operate through static code analysis, measurements, or a combination of both. Such methods give an upper bound of the time required to execute a given task on a given hardware platform. To be useful, WCET estimates have to be as tight as possible. Information on possible flows of control (the so-called flow information) improves the tightness of WCET estimates. Flow information, should it be produced automatically or be inserted manually from annotations, is typically inserted at source code level. On the other hand, WCET analysis is performed at machine code level. Between these two levels, compiler optimizations may have a dramatic effect on the structure of the code, resulting in a loss of useful information. For this reason, many WCET tools for real-time systems turn off compiler optimizations when computing WCET. In this paper, we propose a framework to trace and maintain flow information from source code to machine code to benefit from optimizations, yet improving the WCET estimates. Our implementation in the LLVM compiler shows that we can improve the WCET of Mälardalen benchmarks by 60% in average, and up to 86%. We also provide new insight on the impact of existing optimizations on the WCET.

[1]  David B. Whalley,et al.  Automatic Detection and Exploitation of Branch Constraints for Timing Analysis , 2002, IEEE Trans. Software Eng..

[2]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..

[3]  Markus Schordan Source-To-Source Analysis with SATIrE - an Example Revisited , 2008, Scalable Program Analysis.

[4]  Jakob Engblom,et al.  The worst-case execution-time problem—overview of methods and survey of tools , 2008, TECS.

[5]  Sharad Malik,et al.  Performance analysis of embedded software using implicit path enumeration , 1997, IEEE Trans. Comput. Aided Des. Integr. Circuits Syst..

[6]  Adrian Prantl,et al.  Source-Level Support for Timing Analysis , 2010, ISoLA.

[7]  Armelle Bonenfant,et al.  FFX: a portable WCET annotation language , 2012, RTNS '12.

[8]  Clément Ballabriga,et al.  Partial Flow Analysis with oRange , 2010, ISoLA.

[9]  Benedikt Huber,et al.  Combined WCET analysis of bitcode and machine code using control-flow relation graphs , 2013, LCTES.

[10]  Jakob Engblom,et al.  Facilitating worst-case execution times analysis for optimized code , 1998, Proceeding. 10th EUROMICRO Workshop on Real-Time Systems (Cat. No.98EX168).

[11]  Pascal Raymond,et al.  Timing analysis enhancement for synchronous program , 2013, RTNS.

[12]  Raimund Kirner,et al.  Transforming flow information during code optimization for timing analysis , 2010, Real-Time Systems.

[13]  Daniel Cordes,et al.  A Fast and Precise Static Loop Analysis Based on Abstract Interpretation, Program Slicing and Polytope Models , 2009, 2009 International Symposium on Code Generation and Optimization.

[14]  Isabelle Puaut,et al.  Worst Case Execution Time Analysis for a Processor with Branch Prediction , 2004, Real-Time Systems.