diff options
Diffstat (limited to 'flang/docs')
| -rw-r--r-- | flang/docs/Directives.md | 48 | ||||
| -rw-r--r-- | flang/docs/Extensions.md | 8 |
2 files changed, 32 insertions, 24 deletions
diff --git a/flang/docs/Directives.md b/flang/docs/Directives.md index 3ebb08c..2f16a8d 100644 --- a/flang/docs/Directives.md +++ b/flang/docs/Directives.md @@ -1,9 +1,9 @@ -<!--===- docs/Directives.md - +<!--===- docs/Directives.md + Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - + --> # Compiler directives supported by Flang @@ -12,16 +12,18 @@ A list of non-standard directives supported by Flang * `!dir$ fixed` and `!dir$ free` select Fortran source forms. Their effect persists to the end of the current source file. -* `!dir$ ignore_tkr [[(TKRDMAC)] dummy-arg-name]...` in an interface definition +* `!dir$ ignore_tkr [[(TKRDMACP)] dummy-arg-name]...` in an interface definition disables some semantic checks at call sites for the actual arguments that - correspond to some named dummy arguments (or all of them, by default). - The directive allow actual arguments that would otherwise be diagnosed - as incompatible in type (T), kind (K), rank (R), CUDA device (D), or - managed (M) status. The letter (A) is a shorthand for all of these, - and is the default when no letters appear. The letter (C) checks for - contiguity for example allowing an element of an assumed-shape array to be - passed as a dummy argument. For example, if one wanted to call a "set all - bytes to zero" utility that could be applied to arrays of any type or rank: + correspond to some named dummy arguments (or all of them, by default). The + directive allow actual arguments that would otherwise be diagnosed as + incompatible in type (T), kind (K), rank (R), CUDA device (D), or managed (M) + status. The letter (A) is a shorthand for (TKRDM), and is the default when no + letters appear. The letter (C) checks for contiguity, for example allowing an + element of an assumed-shape array to be passed as a dummy argument. The + letter (P) ignores pointer and allocatable matching, so that one can pass an + allocatable array to routine with pointer array argument and vice versa. For + example, if one wanted to call a "set all bytes to zero" utility that could + be applied to arrays of any type or rank: ``` interface subroutine clear(arr,bytes) @@ -46,27 +48,27 @@ A list of non-standard directives supported by Flang unroll the loop. Some compilers accept an optional `=` before the `n` when `n` is present in the directive. Flang does not. * `!dir$ unroll_and_jam [N]` control how many times a loop should be unrolled and - jammed. It must be placed immediately before a loop that follows. `N` is an optional - integer that specifying the unrolling factor. When `N` is `0` or `1`, the loop + jammed. It must be placed immediately before a loop that follows. `N` is an optional + integer that specifying the unrolling factor. When `N` is `0` or `1`, the loop should not be unrolled at all. If `N` is omitted the optimizer will selects the number of times to unroll the loop. * `!dir$ novector` disabling vectorization on the following loop. * `!dir$ nounroll` disabling unrolling on the following loop. * `!dir$ nounroll_and_jam` disabling unrolling and jamming on the following loop. -* `!dir$ inline` instructs the compiler to attempt to inline the called routines if the - directive is specified before a call statement or all call statements within the loop - body if specified before a DO LOOP or all function references if specified before an +* `!dir$ inline` instructs the compiler to attempt to inline the called routines if the + directive is specified before a call statement or all call statements within the loop + body if specified before a DO LOOP or all function references if specified before an assignment statement. -* `!dir$ forceinline` works in the same way as the `inline` directive, but it forces +* `!dir$ forceinline` works in the same way as the `inline` directive, but it forces inlining by the compiler on a function call statement. -* `!dir$ noinline` works in the same way as the `inline` directive, but prevents +* `!dir$ noinline` works in the same way as the `inline` directive, but prevents any attempt of inlining by the compiler on a function call statement. # Directive Details ## Introduction -Directives are commonly used in Fortran programs to specify additional actions -to be performed by the compiler. The directives are always specified with the +Directives are commonly used in Fortran programs to specify additional actions +to be performed by the compiler. The directives are always specified with the `!dir$` or `cdir$` prefix. ## Loop Directives @@ -97,7 +99,7 @@ check that that construct matches the expected construct for the directive. Skipping other intermediate directives allows multiple directives to appear on the same construct. -## Lowering +## Lowering Evaluation is extended with a new field called dirs for representing directives associated with that Evaluation. When lowering loop directives, the associated Do Loop's evaluation is found and the directive is added to it. This information @@ -109,7 +111,7 @@ about the loop. For example, the `llvm.loop.vectorize.enable` metadata informs the optimizer that a loop can be vectorized without considering its cost-model. This attribute is added to the loop condition branch. -### Representation in MLIR +### Representation in MLIR The MLIR LLVM dialect models this by an attribute called LoopAnnotation Attribute. The attribute can be added to the latch of the loop in the cf dialect and is then carried through lowering to the LLVM dialect. diff --git a/flang/docs/Extensions.md b/flang/docs/Extensions.md index 6d87209..c9cc027 100644 --- a/flang/docs/Extensions.md +++ b/flang/docs/Extensions.md @@ -182,6 +182,13 @@ end Note that internally the main program symbol name is all uppercase, unlike the names of all other symbols, which are usually all lowercase. This may make a difference in testing/debugging. +* A `PROCEDURE()` with no interface name or type may be called as an + subroutine with an implicit interface, F'2023 15.4.3.6 paragraph 4 and + C1525 notwithstanding. + This is a universally portable feature, and it also applies to + `PROCEDURE(), POINTER, NOPASS` derived type components. + Such procedures may *not* be referenced as implicitly typed functions + without first being associated with a function pointer. ## Extensions, deletions, and legacy features supported by default @@ -954,4 +961,3 @@ print *, [(j,j=1,10)] "&GRP A(1:)=1. 2. 3./". This extension is necessarily disabled when the type of the array has an accessible defined formatted READ subroutine. - |
