Skip to content

Commit b2701e5

Browse files
Docs update for ignore_tkr(p)
1 parent b1e54c0 commit b2701e5

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

flang/docs/Directives.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<!--===- docs/Directives.md
2-
1+
<!--===- docs/Directives.md
2+
33
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
See https://llvm.org/LICENSE.txt for license information.
55
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
6+
77
-->
88

99
# Compiler directives supported by Flang
@@ -12,16 +12,18 @@ A list of non-standard directives supported by Flang
1212

1313
* `!dir$ fixed` and `!dir$ free` select Fortran source forms. Their effect
1414
persists to the end of the current source file.
15-
* `!dir$ ignore_tkr [[(TKRDMAC)] dummy-arg-name]...` in an interface definition
15+
* `!dir$ ignore_tkr [[(TKRDMACP)] dummy-arg-name]...` in an interface definition
1616
disables some semantic checks at call sites for the actual arguments that
17-
correspond to some named dummy arguments (or all of them, by default).
18-
The directive allow actual arguments that would otherwise be diagnosed
19-
as incompatible in type (T), kind (K), rank (R), CUDA device (D), or
20-
managed (M) status. The letter (A) is a shorthand for all of these,
21-
and is the default when no letters appear. The letter (C) checks for
22-
contiguity for example allowing an element of an assumed-shape array to be
23-
passed as a dummy argument. For example, if one wanted to call a "set all
24-
bytes to zero" utility that could be applied to arrays of any type or rank:
17+
correspond to some named dummy arguments (or all of them, by default). The
18+
directive allow actual arguments that would otherwise be diagnosed as
19+
incompatible in type (T), kind (K), rank (R), CUDA device (D), or managed (M)
20+
status. The letter (A) is a shorthand for (TKRDM), and is the default when no
21+
letters appear. The letter (C) checks for contiguity for example allowing an
22+
element of an assumed-shape array to be passed as a dummy argument. The
23+
letter (P) ignores pointer and allocatable matching, so that one can pass an
24+
allocatable array to routine with pointer array argument and vice-versa. For
25+
example, if one wanted to call a "set all bytes to zero" utility that could
26+
be applied to arrays of any type or rank:
2527
```
2628
interface
2729
subroutine clear(arr,bytes)
@@ -46,27 +48,27 @@ A list of non-standard directives supported by Flang
4648
unroll the loop. Some compilers accept an optional `=` before the `n` when `n`
4749
is present in the directive. Flang does not.
4850
* `!dir$ unroll_and_jam [N]` control how many times a loop should be unrolled and
49-
jammed. It must be placed immediately before a loop that follows. `N` is an optional
50-
integer that specifying the unrolling factor. When `N` is `0` or `1`, the loop
51+
jammed. It must be placed immediately before a loop that follows. `N` is an optional
52+
integer that specifying the unrolling factor. When `N` is `0` or `1`, the loop
5153
should not be unrolled at all. If `N` is omitted the optimizer will
5254
selects the number of times to unroll the loop.
5355
* `!dir$ novector` disabling vectorization on the following loop.
5456
* `!dir$ nounroll` disabling unrolling on the following loop.
5557
* `!dir$ nounroll_and_jam` disabling unrolling and jamming on the following loop.
56-
* `!dir$ inline` instructs the compiler to attempt to inline the called routines if the
57-
directive is specified before a call statement or all call statements within the loop
58-
body if specified before a DO LOOP or all function references if specified before an
58+
* `!dir$ inline` instructs the compiler to attempt to inline the called routines if the
59+
directive is specified before a call statement or all call statements within the loop
60+
body if specified before a DO LOOP or all function references if specified before an
5961
assignment statement.
60-
* `!dir$ forceinline` works in the same way as the `inline` directive, but it forces
62+
* `!dir$ forceinline` works in the same way as the `inline` directive, but it forces
6163
inlining by the compiler on a function call statement.
62-
* `!dir$ noinline` works in the same way as the `inline` directive, but prevents
64+
* `!dir$ noinline` works in the same way as the `inline` directive, but prevents
6365
any attempt of inlining by the compiler on a function call statement.
6466

6567
# Directive Details
6668

6769
## Introduction
68-
Directives are commonly used in Fortran programs to specify additional actions
69-
to be performed by the compiler. The directives are always specified with the
70+
Directives are commonly used in Fortran programs to specify additional actions
71+
to be performed by the compiler. The directives are always specified with the
7072
`!dir$` or `cdir$` prefix.
7173

7274
## Loop Directives
@@ -97,7 +99,7 @@ check that that construct matches the expected construct for the directive.
9799
Skipping other intermediate directives allows multiple directives to appear on
98100
the same construct.
99101

100-
## Lowering
102+
## Lowering
101103
Evaluation is extended with a new field called dirs for representing directives
102104
associated with that Evaluation. When lowering loop directives, the associated
103105
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
109111
the optimizer that a loop can be vectorized without considering its cost-model.
110112
This attribute is added to the loop condition branch.
111113

112-
### Representation in MLIR
114+
### Representation in MLIR
113115
The MLIR LLVM dialect models this by an attribute called LoopAnnotation
114116
Attribute. The attribute can be added to the latch of the loop in the cf
115117
dialect and is then carried through lowering to the LLVM dialect.

0 commit comments

Comments
 (0)