Files
llvm/flang
Razvan Lupusoru 9077522b2b [acc][flang] Define hasUnknownDimensions in MappableType (#165794)
The MappableType interface currently defines a `generateAccBounds`
method which examines a variable and generates `acc.bounds` operations
that encode its dimensions. The implementation can extract bounds
information in various ways: either from the MLIR type itself or by
analyzing the IR to find dimension information from defining operations.

However, we need to distinguish between cases where dimensional
information is not directly available from the type itself. This new
`hasUnknownDimensions` API returns true when the MLIR type does not
encode dimensional information and there is no associated descriptor or
metadata that would make this information extractable from the visible
ssa value the represents the variable. The expected use case is calling
`generateAccBounds` only when this returns true, as it indicates that
bounds must be extracted from the IR (by walking back from current
variable to its defining spots or its descriptor).

This supports cases such as raw references to arrays with non-constant
bounds (e.g., explicit-shape arrays in Fortran where bounds are passed
as arguments). This functionality could also be leveraged for CIR VLA
support in the future.

For FIR types:
- Box types return false (descriptor encodes dimensions)
- Reference types check if the pointee has dynamic size using
fir::hasDynamicSize()
2025-10-30 16:17:00 -07:00
..

Flang

Flang is a ground-up implementation of a Fortran front end written in modern C++. It started off as the f18 project (https://github.com/flang-compiler/f18) with an aim to replace the previous flang project (https://github.com/flang-compiler/flang) and address its various deficiencies. F18 was subsequently accepted into the LLVM project and rechristened as Flang.

Please note that flang is not ready yet for production usage.

Getting Started

Read more about flang in the docs directory. Start with the compiler overview.

To better understand Fortran as a language and the specific grammar accepted by flang, read Fortran For C Programmers and flang's specifications of the Fortran grammar and the OpenMP grammar.

Treatment of language extensions is covered in this document.

To understand the compilers handling of intrinsics, see the discussion of intrinsics.

To understand how a flang program communicates with libraries at runtime, see the discussion of runtime descriptors.

If you're interested in contributing to the compiler, read the style guide and also review how flang uses modern C++ features.

If you are interested in writing new documentation, follow LLVM's Markdown style guide.

Consult the Getting Started with Flang for information on building and running flang.