Skip to content

Commit 7ca4012

Browse files
authored
[flang][docs] Fix broken flang website (llvm#80363)
These are several fixes for the flang site. The look has been changed to match clang since flang, like clang, is a frontend. Some broken links were removed. Most fixes are to secton titles so the table of contents is generated correctly. A minor typo has been fixed.
1 parent 74fb205 commit 7ca4012

11 files changed

+81
-92
lines changed

flang/docs/AliasingAnalysisFIR.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ Because of block arguments, a memory reference may have multiple sources. If a b
7474
### Pointer type
7575
A type `fir.box<fir.ptr<T>>` or `fir.ptr<T>`
7676

77-
# Aliasing rules
77+
## Aliasing rules
7878
The goal is to match [Fortran’s rule for aliasing](Aliasing.md). However FIR is all we have at this stage so the hope is that we can define an algorithm using the information from FIR to properly model Fortran’s aliasing rules. Wherever there is a gap, we may have to refine the algorithm, add information in FIR or both. Though, with the introduction of the fir.declare operation, most of the source level information relevant to aliasing will be populated in FIR.
7979

8080
The first attempt to determine aliasing will be at the coarsest level: the source level. The answer to the query will be ‘yes’, ‘no’, ‘maybe’. If the answer is ‘yes’ or ‘no’, the query is complete. If the answer is ‘maybe’ then further analysis is required until a definite answer is reached. If no finer analysis is available then 'maybe' is returned.
8181

82-
## Coarse rules
82+
### Coarse rules
8383
Distinct sources are assumed to not alias except in the following cases:
8484
1. A pointer type source may alias with any other pointer type source.
8585
1. A source with the fir.target attribute may alias with any other pointer type source.

flang/docs/FIRArrayOperations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ reference, and its semantics guarantee immutability.
9090
// a fir.store here into array %a does not change %v
9191
```
9292

93-
# array_merge_store
93+
## array_merge_store
9494

9595
The `array_merge_store` operation stores a merged array value to memory.
9696

flang/docs/FlangDriver.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ At this point you should be able to trigger that frontend action that you have
383383
just added using your new frontend option.
384384

385385

386-
# CMake Support
386+
## CMake Support
387387
As of [#7246](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7246)
388388
(and soon to be released CMake 3.24.0), `cmake` can detect `flang-new` as a
389389
supported Fortran compiler. You can configure your CMake projects to use
@@ -397,7 +397,7 @@ You should see the following in the output:
397397
```
398398
where `<version>` corresponds to the LLVM Flang version.
399399

400-
# Testing
400+
## Testing
401401
In LIT, we define two variables that you can use to invoke Flang's drivers:
402402
* `%flang` is expanded as `flang-new` (i.e. the compiler driver)
403403
* `%flang_fc1` is expanded as `flang-new -fc1` (i.e. the frontend driver)
@@ -416,7 +416,7 @@ test as only available on Unix-like systems (i.e. systems that contain a Unix
416416
shell). In practice this means that the corresponding test is skipped on
417417
Windows.
418418

419-
# Frontend Driver Plugins
419+
## Frontend Driver Plugins
420420
Plugins are an extension to the frontend driver that make it possible to run
421421
extra user defined frontend actions, in the form of a specialization of a
422422
`PluginParseTreeAction`. These actions are run during compilation, after
@@ -429,7 +429,7 @@ plugins. The process for using plugins includes:
429429
Flang plugins are limited to `flang-new -fc1` and are currently only available /
430430
been tested on Linux.
431431

432-
## Creating a Plugin
432+
### Creating a Plugin
433433
There are three parts required for plugins to work:
434434
1. [`PluginParseTreeAction` subclass](#a-pluginparsetreeaction-subclass)
435435
1. [Implementation of `ExecuteAction`](#implementation-of-executeaction)
@@ -439,7 +439,7 @@ There is an example plugin located in `flang/example/PrintFlangFunctionNames`
439439
that demonstrates these points by using the `ParseTree` API to print out
440440
function and subroutine names declared in the input file.
441441

442-
### A `PluginParseTreeAction` Subclass
442+
#### A `PluginParseTreeAction` Subclass
443443
This subclass will wrap everything together and represent the `FrontendAction`
444444
corresponding to your plugin. It will need to inherit from
445445
`PluginParseTreeAction` (defined in `flang/include/flang/FrontendActions.h`), in
@@ -449,7 +449,7 @@ can be registered, e.g.
449449
class PrintFunctionNamesAction : public PluginParseTreeAction
450450
```
451451
452-
### Implementation of `ExecuteAction`
452+
#### Implementation of `ExecuteAction`
453453
Like in other frontend actions, the driver looks for an `ExecuteAction` function
454454
to run, so in order for your plugin to do something, you will need to implement
455455
the `ExecuteAction` method in your plugin class. This method will contain the
@@ -494,7 +494,7 @@ defined in `flang/include/flang/Parser/parse-tree.h`. In the example, there is a
494494
the `FunctionStmt` struct and prints it. This function will be run after every
495495
`FunctionStmt` node is visited in the parse tree.
496496
497-
### Plugin Registration
497+
#### Plugin Registration
498498
A plugin registry is used to store names and descriptions of a collection of
499499
plugins. The Flang plugin registry, defined in
500500
`flang/include/flang/Frontend/FrontendPluginRegistry.h`, is an alias of
@@ -509,7 +509,7 @@ static FrontendPluginRegistry::Add<PrintFunctionNamesAction> X(
509509
"print-fns", "Print Function names");
510510
```
511511

512-
## Loading and Running a Plugin
512+
### Loading and Running a Plugin
513513
In order to use plugins, there are 2 command line options made available to the
514514
frontend driver, `flang-new -fc1`:
515515
* [`-load <dsopath>`](#the--load-dsopath-option) for loading the dynamic shared
@@ -525,19 +525,19 @@ Both these options are parsed in `flang/lib/Frontend/CompilerInvocation.cpp` and
525525
fulfil their actions in
526526
`flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp`
527527

528-
### The `-load <dsopath>` option
528+
#### The `-load <dsopath>` option
529529
This loads the plugin shared object library, with the path given at `<dsopath>`,
530530
using `LoadLibraryPermantly` from LLVM's `llvm::sys::DynamicLibrary`, which
531531
itself uses `dlopen`. During this stage, the plugin is registered with the
532532
registration line from the plugin, storing the name and description.
533533

534-
### The `-plugin <name>` option
534+
#### The `-plugin <name>` option
535535
This sets `frontend::ActionKind programAction` in `FrontendOptions` to
536536
`PluginAction`, through which it searches the plugin registry for the plugin
537537
name from `<name>`. If found, it returns the instantiated plugin, otherwise it
538538
reports an error diagnostic and returns `nullptr`.
539539

540-
## Enabling In-Tree Plugins
540+
### Enabling In-Tree Plugins
541541
For in-tree plugins, there is the CMake flag `FLANG_PLUGIN_SUPPORT`, enabled by
542542
default, that controls the exporting of executable symbols from `flang-new`,
543543
which plugins need access to. Additionally, there is the CMake flag
@@ -547,7 +547,7 @@ example programs are built. This includes plugins that are in the
547547
`flang/examples/CMakeLists.txt`, for example, the `PrintFlangFunctionNames`
548548
plugin. It is also possible to develop plugins out-of-tree.
549549

550-
## Limitations
550+
### Limitations
551551
Note that the traversal API presented here is under active development and
552552
might change in the future. We expect it to evolve as support for new
553553
language features are added. This document and the examples will be updated
@@ -564,7 +564,7 @@ to re-analyze expressions and modify scope or symbols. You can check
564564
[Semantics.md](Semantics.md) for more details on how `ParseTree` is edited
565565
e.g. during the semantic checks.
566566

567-
# LLVM Pass Plugins
567+
## LLVM Pass Plugins
568568

569569
Pass plugins are dynamic shared objects that consist of one or more LLVM IR
570570
passes. The `-fpass-plugin` option enables these passes to be passed to the

flang/docs/HighLevelFIR.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# High-Level Fortran IR (HLFIR)
2+
13
The approach of FIR and lowering design so far was to start with the minimal set
24
of IR operations that could allow implementing the core aspects of Fortran (like
35
memory allocations, array addressing, runtime descriptors, and structured
@@ -41,9 +43,9 @@ The core impact on lowering will be:
4143
relevant.
4244

4345

44-
# Variable and Expression value concepts in HLFIR
46+
## Variable and Expression value concepts in HLFIR
4547

46-
## Strengthening the variable concept
48+
### Strengthening the variable concept
4749

4850
Fortran variables are currently represented in FIR as mlir::Value with reference
4951
or box type coming from special operations or block arguments. They are either
@@ -128,7 +130,7 @@ from the caller scope name and the function name.). In general, fir.declare
128130
will allow to view every memory storage as a variable, and this will be used to
129131
describe and use compiler created array temporaries.
130132

131-
## Adding an expression value concept in HLFIR
133+
### Adding an expression value concept in HLFIR
132134

133135
Currently, Fortran expressions can be represented as SSA values for scalar
134136
logical, integer, real, and complex expressions. Scalar character or
@@ -1353,9 +1355,9 @@ will be inlined, hlfir.forall will be rewritten into normal loops taking into
13531355
account the alias analysis, and hlfir.assign/hlfir.designate operations will be
13541356
lowered to fir.array_coor and fir.store operations).
13551357

1356-
# Alternatives that were not retained
1358+
## Alternatives that were not retained
13571359

1358-
## Using a non-MLIR based mutable CFG representation
1360+
### Using a non-MLIR based mutable CFG representation
13591361

13601362
An option would have been to extend the PFT to describe expressions in a way
13611363
that can be annotated and modified with the ability to introduce temporaries.
@@ -1364,9 +1366,9 @@ infrastructure and data structures while FIR is already using MLIR
13641366
infrastructure, so enriching FIR seems a smoother approach and will benefit from
13651367
the MLIR infrastructure experience that was gained.
13661368

1367-
## Using symbols for HLFIR variables
1369+
### Using symbols for HLFIR variables
13681370

1369-
### Using attributes as pseudo variable symbols
1371+
#### Using attributes as pseudo variable symbols
13701372

13711373
Instead of restricting the memory types an HLFIR variable can have, it was
13721374
force the defining operation of HLFIR variable SSA values to always be
@@ -1390,7 +1392,7 @@ doing code motion, and whose complexity would be increased by the naming
13901392
constraints.
13911393

13921394

1393-
### Using MLIR symbols for variables
1395+
#### Using MLIR symbols for variables
13941396

13951397
Using MLIR symbols for HLFIR variables has been rejected because MLIR symbols
13961398
are mainly intended to deal with globals and functions that may refer to each
@@ -1407,9 +1409,9 @@ Using SSA values also makes the transition and mixture with lower-level FIR
14071409
operations smoother: a variable SSA usage can simply be replaced by lower-level
14081410
FIR operations using the same SSA value.
14091411

1410-
## Using some existing MLIR dialects for the high-level Fortran.
1412+
### Using some existing MLIR dialects for the high-level Fortran.
14111413

1412-
### Why not using Linalg dialect?
1414+
#### Why not using Linalg dialect?
14131415

14141416
The linalg dialects offers a powerful way to represent array operations: the
14151417
linalg.generic operation takes a set of input and output arrays, a related set
@@ -1438,7 +1440,7 @@ semi-affine cases).
14381440
So using linalg is for now left as an optimization pass opportunity in some
14391441
cases that could be experimented.
14401442

1441-
### Why not using Shape dialect?
1443+
#### Why not using Shape dialect?
14421444

14431445
MLIR shape dialect gives a set of operations to manipulate shapes. The
14441446
shape.meet operation is exactly similar with hlfir.shape_meet, except that it
@@ -1451,7 +1453,7 @@ shape.meet The shape dialect is a lot more complex because it is intended to
14511453
deal with computations involving dynamically ranked entity, which is not the
14521454
case in Fortran (assumed rank usage in Fortran is greatly limited).
14531455

1454-
## Using embox/rebox and box as an alternative to fir.declare/hlfir.designate and hlfir.expr/ variable concept
1456+
### Using embox/rebox and box as an alternative to fir.declare/hlfir.designate and hlfir.expr/ variable concept
14551457

14561458
All Fortran entities (*) can be described at runtime by a fir.box, except for
14571459
some attributes that are not part of the runtime descriptors (like TARGET,

flang/docs/OpenACC-descriptor-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,6 @@ All the "is-present" checks and the data actions for the auxiliary pointers must
429429
430430
The API relies on the primitives provided by `liboffload`, so it is provided by a new F18 runtime library, e.g. `FortranOffloadRuntime`, that depends on `FortranRuntime` and `liboffload`. The F18 driver adds `FortranOffloadRuntime` for linking under `-fopenacc`/`-fopenmp` (and maybe additional switches like `-fopenmp-targets`).
431431
432-
# TODOs:
432+
## TODOs:
433433
434434
* Cover the detach action.

flang/docs/Overview.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ produce a readable version of the outputs.
3939

4040
Each detailed phase produces either correct output or fatal errors.
4141

42-
# Analysis
42+
## Analysis
4343

4444
This high level phase validates that the program is correct and creates all of
4545
the information needed for lowering.
4646

47-
## Prescan and Preprocess
47+
### Prescan and Preprocess
4848

4949
See [Preprocessing.md](Preprocessing.md).
5050

@@ -69,7 +69,7 @@ See [Preprocessing.md](Preprocessing.md).
6969
- `flang-new -fc1 -fdebug-dump-provenance src.f90` dumps provenance
7070
information
7171

72-
## Parsing
72+
### Parsing
7373

7474
**Input:** Cooked character stream
7575

@@ -85,7 +85,7 @@ representing a syntactically correct program, rooted at the program unit. See:
8585
- `flang-new -fc1 -fdebug-dump-parsing-log src.f90` runs an instrumented parse and dumps the log
8686
- `flang-new -fc1 -fdebug-measure-parse-tree src.f90` measures the parse tree
8787

88-
## Semantic processing
88+
### Semantic processing
8989

9090
**Input:** the parse tree, the cooked character stream, and provenance
9191
information
@@ -125,12 +125,12 @@ At the end of semantic processing, all validation of the user's program is compl
125125
- `flang-new -fc1 -fdebug-dump-symbols src.f90` dumps the symbol table
126126
- `flang-new -fc1 -fdebug-dump-all src.f90` dumps both the parse tree and the symbol table
127127

128-
# Lowering
128+
## Lowering
129129

130130
Lowering takes the parse tree and symbol table produced by analysis and
131131
produces LLVM IR.
132132

133-
## Create the lowering bridge
133+
### Create the lowering bridge
134134

135135
**Inputs:**
136136
- the parse tree
@@ -148,7 +148,7 @@ The lowering bridge is a container that holds all of the information needed for
148148

149149
**Entry point:** lower::LoweringBridge::create
150150

151-
## Initial lowering
151+
### Initial lowering
152152

153153
**Input:** the lowering bridge
154154

@@ -166,7 +166,7 @@ parse tree. The compiler walks the PFT generating FIR.
166166
- `flang-new -fc1 -fdebug-dump-pft src.f90` dumps the pre-FIR tree
167167
- `flang-new -fc1 -emit-mlir src.f90` dumps the FIR to the files src.mlir
168168

169-
## Transformation passes
169+
### Transformation passes
170170

171171
**Input:** initial version of the FIR code
172172

@@ -183,7 +183,7 @@ LLVM IR representation of the program.
183183
- `flang-new -mmlir --mlir-print-ir-after-all -S src.f90` dumps the FIR code after each pass to standard error
184184
- `flang-new -fc1 -emit-llvm src.f90` dumps the LLVM IR to src.ll
185185

186-
# Object code generation and linking
186+
## Object code generation and linking
187187

188188
After the LLVM IR is created, the flang driver invokes LLVM's existing
189189
infrastructure to generate object code and invoke a linker to create the

0 commit comments

Comments
 (0)