IRILL - Research and Innovation on Free Software

Performing Source-to-Source Transformations with Clang


"Performing Source-to-Source Transformations with Clang"
by Olaf Krzikalla - TU Dresden,
on 2013-04-29 00:00:00
Download Webm format
Download MP4 format

Back in 2009 we started to develop a configurable source-to-source transformation tool designed to automatically vectorize C/C++ source code using SIMD instructions. Meanwhile the tool, called Scout, is an industrial-strength vectorizing preprocessor, which is used on a day-to-day basis in the software production process of the German Aerospace Center. The code is published as Open Source and can be downloaded from http://scout.zih.tu-dresden.de. The source-to-source transformation framework of Scout is based on the AST and the accompanying infrastructure of Clang. Beside the actual vectorization the framework provides function inlining, loop-unrolling and loop-unswitching at AST level. For this a C/C++ file is parsed, the generated AST is transformed and then written back to a target file. However this approach is critical, since the AST of Clang is actually immutable by design. On the other hand there is a lot of interest in source-to-source transformation tools based on Clang, as can be seen on cfe-dev and in other talks. In our talk we will present our experiences, the technologies used and possible future directions of the development of source-to-source transformation tools.