Coding

Flang – LLVM Fortran compiler

Flang is a Fortran compiler developed as part of the LLVM project. It provides a language frontend for parsing, analysing, and compiling Fortran programs using LLVM’s compiler infrastructure. Flang is designed to support scientific computing, numerical analysis, and other applications where Fortran remains an important programming language.

The compiler uses a multi-stage compilation pipeline that includes parsing, semantic analysis, intermediate representation generation, optimisation, and machine-code generation. It introduces Fortran Intermediate Representation (FIR) and High-Level Fortran Intermediate Representation (HLFIR), which are based on LLVM’s MLIR infrastructure. These representations allow Fortran-specific language constructs to be analysed and transformed before being lowered to LLVM IR. Flang is distinct from the earlier Classic Flang compiler, which was developed separately from the implementation now included in LLVM.

This is free and open source software.

Key Features

  • Fortran language frontend with parsing and semantic analysis.
  • Compiler driver coordinates preprocessing, compilation, assembly, and linking.
  • Generates native machine code through the LLVM compiler infrastructure.
  • Fortran Intermediate Representation provides a dedicated representation of Fortran program semantics.
  • High-Level Fortran Intermediate Representation preserves higher-level operations for compiler transformations.
  • MLIR integration supports staged lowering and optimisation of program representations.
  • Support for Fortran modules, derived types, arrays, procedures, and intrinsic operations.
  • Handles many legacy Fortran language extensions alongside standard language constructs.
  • OpenMP support for shared-memory parallel programming.
  • Compiler diagnostics identify syntax errors, invalid declarations, and semantic problems.
  • Preprocessor support for conditional compilation and macro processing.
  • Optimisation passes take advantage of LLVM’s code-generation infrastructure.
  • Runtime support for Fortran input/output and language-specific operations.
  • Cross-platform support – runs on Linux and macOS.

Website: github.com/llvm/llvm-project/tree/main/flang
Support:
Developer: LLVM Project contributors
License: Apache License 2.0 with LLVM Exceptions

Flang is written in C++. Learn C++ with our recommended free books and free tutorials.


Related Software

Compilers
GNU Compiler CollectionThe standard compiler for most Unix-like operating systems
rustcCompiler for the Rust programming language
AOCCAMD Optimizing C/C++ Compiler
LLVMLow-Level Virtual Machine (LLVM) compiler for C/C++
ispcIntel SPMD Program Compiler
BabelJavaScript compiler - use next generation JavaScript
Glasgow Haskell CompilerAn optimizing compiler for Haskell, written in Haskell
ClangC Language Family Frontend for LLVM
NuitkaOptimizing Python compiler
CHICKENCompiler for the Scheme programming language
FreeBASIC32-bit BASIC compiler
NumbaCompiler for Python array and numerical functions
Free PascalAdvanced Pascal compiler for Pascal and Object Pascal
NASMAssembler for the x86 CPU architecture
BiglooPractical Scheme compiler

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted