During my master project i worked on combining LLVM with a WCET tool.
Worst-Case-Execution-Time (WCET) is the longest time a program can execute, typically measured in cycles. This information is typically of interest for code that has timing requirements such embedded systems in cars.
The project involved combining an open-source tool called SWEET with LLVM. This involves using datastructures in LLVM to output the interface-language to the tool SWEET. As a proof-of-concept, the ARM Cortex-m0 has been chosen and an attempt has been made to automatically generate a WCET analysis during compilation.
This talk will explain my findings in the project and explain the concept of WCET in general.
The SWEET tool is an open-source tool that allows the computation of the Worst-Case-Execution-Time of software (WCET). WCET is important for software that has hard real-time requirements. (example: interrupt routine that needs to finish within a pre-determined set of cycles).
SWEET interprets its own language and does not work on a processors instruction set architecture (ISA) or high-level languages like C or C++. The language SWEET uses is called ALF (artist2 flow language).
This ALF language is what makes SWEET so special, it is possible to transform an ISA to ALF. The binary does not have to be de-compiled, ALF can be generated from the compiler.
For example: an add instruction like add r0, r1, r2. { store { addr 32 { fref 32 r } { decunsigned 32 0 }} { add 32 { load 32 { addr 32 { fref 32 r } { decunsigned 32 1 }}} { load 32 { addr 32 { fref 32 r } { decunsigned 32 2 }}} { decunsigned 1 0 } } }
The goal of this project is to generate ALF code using semantic information available in LLVM (information about what the instructions is doing like the computation). For this purpose things like the dag-pattern and register classes are used.
During the project the arm thumb architecture was chosen to generate ALF for as an example.
It is expected that this could be used for other architectures as well.
Speakers: Rick Veens