License:
Creative Commons Attribution 4.0 International license (CC BY 4.0)
When quoting this document, please refer to the following
DOI: 10.4230/OASIcs.PARMA-DITAM.2023.2
URN: urn:nbn:de:0030-drops-177225
URL: https://drops.dagstuhl.de/opus/volltexte/2023/17722/
Bispo, João ;
Paulino, Nuno ;
Sousa, Luís Miguel
Challenges and Opportunities in C/C++ Source-To-Source Compilation (Invited Paper)
Abstract
The C/C++ compilation stack (Intermediate Representations (IR), compilation passes and backends) is encumbered by a steep learning curve, which we believe can be lowered by complementing it with approaches such as source-to-source compilation. Source-to-source compilation is a technology that is widely used and quite mature in certain programming environments, such as JavaScript, but that faces a low adoption rate in others. In the particular case of C and C++ some of the identified factors include the high complexity of the languages, increased difficulty in building and maintaining C/C++ parsers, or limitations on using source code as an intermediate representation. Additionally, new technologies such as Multi-Level Intermediate Representation (MLIR) have appeared as potential competitors to source-to-source compilers at this level.
In this paper, we present what we have identified as current challenges of source-to-source compilation of C and C++, as well as what we consider to be opportunities and possible directions forward. We also present several examples, implemented on top of the Clava source-to-source compiler, that use some of these ideas and techniques to raise the abstraction level of compiler research on complex compiled languages such as C or C++. The examples include automatic parallelization of for loops, high-level synthesis optimisation, hardware/software partitioning with run-time decisions, and automatic insertion of inline assembly for fast prototyping of custom instructions.
BibTeX - Entry
@InProceedings{bispo_et_al:OASIcs.PARMA-DITAM.2023.2,
author = {Bispo, Jo\~{a}o and Paulino, Nuno and Sousa, Lu{\'\i}s Miguel},
title = {{Challenges and Opportunities in C/C++ Source-To-Source Compilation}},
booktitle = {14th Workshop on Parallel Programming and Run-Time Management Techniques for Many-Core Architectures and 12th Workshop on Design Tools and Architectures for Multicore Embedded Computing Platforms (PARMA-DITAM 2023)},
pages = {2:1--2:15},
series = {Open Access Series in Informatics (OASIcs)},
ISBN = {978-3-95977-269-3},
ISSN = {2190-6807},
year = {2023},
volume = {107},
editor = {Bispo, Jo\~{a}o and Charles, Henri-Pierre and Cherubin, Stefano and Massari, Giuseppe},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/opus/volltexte/2023/17722},
URN = {urn:nbn:de:0030-drops-177225},
doi = {10.4230/OASIcs.PARMA-DITAM.2023.2},
annote = {Keywords: Source-to-source, compilation, transpilers, C/C++, code transformation}
}
Keywords: |
|
Source-to-source, compilation, transpilers, C/C++, code transformation |
Collection: |
|
14th Workshop on Parallel Programming and Run-Time Management Techniques for Many-Core Architectures and 12th Workshop on Design Tools and Architectures for Multicore Embedded Computing Platforms (PARMA-DITAM 2023) |
Issue Date: |
|
2023 |
Date of publication: |
|
13.03.2023 |