Fortran source-to-source compiler based on the LARA framework.
This compiler will be heavily inspired by Clava, a C/C++ source-to-source compiler that is also based on the LARA framework.
Clava already supports the following transformations:
- Automatic insertion of OpenMP pragmas
- Function inlining
- Function outlining
- Array flattening
- Constant folding and propagation
- Struct decomposition
- Function voidification
- Normalizing code to a subset of the language, including:
- Conversion of switch statements to ifs
- Loop conversion (for to while, do to while)
- Ensure there is a single return in a function
- Remove variable shadowing
- Simplify ternary operator
- Simplify compound assignments
The next steps for the Fortran source-to-source compiler are as follows:
- Developing an AST-based IR to represent Fortran that is capable of generating Fortran code back from the IR [Java]
- Dumper based on the Flang parser capable of outputting the necessary information to reconstruct an IR of the source code [C++]
- Base API [TypeScript]
- Library for Fortran transformations, which should include [TypeScript]:
- Loop unrolling
- Loop tiling
- Loop interchange
- Loop fission
- Loop fusion
- Loop-invariant code motion
- Loop peeling
- Loop strip-mining
- OpenMP directive transformations. These tranformations should transform code with OpenMP directives not-yet supported by Flang into code with supported directives. The particular transformations to target are dependent of inputs from partners
This work was supported by EU funds through the Digital Autonomy with RISC-V in Europe (DARE) Specific Grant Agreement 1 (SGA1) Project under European High-Performance Computing Joint Undertaking (JU) under Agreement 101202459.
This work was developed in the context of research activities conducted at INESC TEC and the Faculty of Engineering of the University of Porto (FEUP).