Skip to content

Commit 413467f

Browse files
DavidTrubyDavid Truby
authored andcommitted
[flang] [NFC] Adjust README.md for upstreaming.
This changes the references and build instructions for Flang so that they are correct now that F18 has been rechristened Flang and merged with LLVM. Reviewed at: flang-compiler/f18#909
1 parent 4408e6a commit 413467f

File tree

1 file changed

+50
-111
lines changed

1 file changed

+50
-111
lines changed

flang/README.md

Lines changed: 50 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
1-
<!--===- README.md
1+
# Flang
22

3-
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
See https://llvm.org/LICENSE.txt for license information.
5-
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
7-
-->
8-
9-
# F18
10-
11-
F18 is a ground-up implementation of a Fortran front end written in modern C++.
12-
F18, when combined with LLVM, is intended to replace the Flang compiler.
13-
14-
Flang is a Fortran compiler targeting LLVM.
15-
Visit the [Flang wiki](https://github.com/flang-compiler/flang/wiki)
16-
for more information about Flang.
3+
Flang is a ground-up implementation of a Fortran front end written in modern
4+
C++. It started off as the f18 project (https://github.com/flang-compiler/f18)
5+
with an aim to replace the previous flang project
6+
(https://github.com/flang-compiler/flang) and address its various deficiencies.
7+
F18 was subsequently accepted into the LLVM project and rechristened as Flang.
178

189
## Getting Started
1910

20-
Read more about f18 in the [documentation directory](documentation).
11+
Read more about flang in the [documentation directory](documentation).
2112
Start with the [compiler overview](documentation/Overview.md).
2213

2314
To better understand Fortran as a language
24-
and the specific grammar accepted by f18,
15+
and the specific grammar accepted by flang,
2516
read [Fortran For C Programmers](documentation/FortranForCProgrammers.md)
2617
and
27-
f18's specifications of the [Fortran grammar](documentation/f2018-grammar.txt)
18+
flang's specifications of the [Fortran grammar](documentation/f2018-grammar.txt)
2819
and
2920
the [OpenMP grammar](documentation/OpenMP-4.5-grammar.txt).
3021

@@ -34,49 +25,52 @@ in [this document](documentation/Extensions.md).
3425
To understand the compilers handling of intrinsics,
3526
see the [discussion of intrinsics](documentation/Intrinsics.md).
3627

37-
To understand how an f18 program communicates with libraries at runtime,
28+
To understand how a flang program communicates with libraries at runtime,
3829
see the discussion of [runtime descriptors](documentation/RuntimeDescriptor.md).
3930

4031
If you're interested in contributing to the compiler,
4132
read the [style guide](documentation/C++style.md)
4233
and
43-
also review [how f18 uses modern C++ features](documentation/C++17.md).
34+
also review [how flang uses modern C++ features](documentation/C++17.md).
4435

45-
## Building F18
46-
47-
### Get the Source Code
48-
49-
```
50-
cd where/you/want/the/source
51-
git clone https://github.com/flang-compiler/f18.git
52-
```
36+
## Supported C++ compilers
5337

54-
### Supported C++ compilers
55-
56-
F18 is written in C++17.
38+
Flang is written in C++17.
5739

5840
The code has been compiled and tested with
59-
GCC versions 7.2.0, 7.3.0, 8.1.0, and 8.2.0.
41+
GCC versions from 7.2.0 to 9.3.0.
6042

6143
The code has been compiled and tested with
62-
clang version 7.0 and 8.0
44+
clang version 7.0, 8.0, 9.0 and 10.0
6345
using either GNU's libstdc++ or LLVM's libc++.
6446

65-
### LLVM dependency
47+
The code has been compiled on
48+
AArch64, x86\_64 and ppc64le servers
49+
with CentOS7, Ubuntu18.04, Rhel, MacOs, Mojave, XCode and
50+
Apple Clang version 10.0.1.
6651

67-
F18 uses components from LLVM.
52+
The code does not compile with Windows and a compiler that does not have
53+
support for C++17.
54+
55+
## Building Flang out of tree
56+
These instructions are for building Flang separately from LLVM; if you are
57+
building Flang alongside LLVM then follow the standard LLVM build instructions
58+
and add flang to `LLVM_ENABLE_PROJECTS` instead, as detailed there.
59+
60+
### LLVM dependency
6861

6962
The instructions to build LLVM can be found at
70-
https://llvm.org/docs/GettingStarted.html.
63+
https://llvm.org/docs/GettingStarted.html. If you are building flang as part
64+
of LLVM, follow those instructions and add flang to `LLVM_ENABLE_PROJECTS`.
7165

72-
We highly recommend using the same compiler to compile both llvm and f18.
66+
We highly recommend using the same compiler to compile both llvm and flang.
7367

74-
The f18 CMakeList.txt file uses
68+
The flang CMakeList.txt file uses
7569
the variable `LLVM_DIR` to find the installed LLVM components
7670
and
7771
the variable `MLIR_DIR` to find the installed MLIR components.
7872

79-
To get the correct LLVM and MLIR libraries included in your f18 build,
73+
To get the correct LLVM and MLIR libraries included in your flang build,
8074
define LLVM_DIR and MLIR_DIR on the cmake command line.
8175
```
8276
LLVM=<LLVM_BUILD_DIR>/lib/cmake/llvm \
@@ -86,71 +80,17 @@ cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ...
8680
where `LLVM_BUILD_DIR` is
8781
the top-level directory where LLVM was built.
8882

89-
### LLVM dependency when building f18 with Fortran IR
90-
91-
If you do not want to build Fortran IR, add `-DLINK_WITH_FIR=Off` to f18 cmake
92-
command and ignore the rest of this section.
93-
94-
If you intend to build f18 with Fortran IR (`-DLINK_WITH_FIR` On by default),
95-
you must:
96-
- build LLVM with the same compiler and options as the one you are using
97-
to build F18.
98-
- pass `-DCMAKE_CXX_STANDARD=17 -DLLVM_ENABLE_PROJECTS="mlir"`
99-
to LLVM cmake command.
100-
- install LLVM somewhere with `make install` in order to get the required
101-
AddMLIR cmake file (it is not generated in LLVM build directory).
102-
103-
Installing LLVM from packages is most likely not an option as it will not include
104-
MLIR and not be built following C++17 standard.
105-
106-
MLIR is under active development and the most recent development version
107-
may be incompatible. A branch named `f18` is available inside LLVM fork in
108-
https://github.com/flang-compiler/f18-llvm-project. It contains a version of LLVM
109-
that is known be compatible to build f18 with FIR.
110-
111-
The fastest way to get set up is to do:
112-
113-
```
114-
cd where/you/want/to/build/llvm
115-
git clone --depth=1 -b f18 https://github.com/flang-compiler/f18-llvm-project.git
116-
mkdir build
117-
mkdir install
118-
cd build
119-
cmake ../f18-llvm-project/llvm -DCMAKE_BUILD_TYPE=Release \
120-
-DLLVM_ENABLE_PROJECTS=mlir -DCMAKE_CXX_STANDARD=17 \
121-
-DLLVM_INSTALL_UTILS=On \
122-
-DCMAKE_INSTALL_PREFIX=../install
123-
make
124-
make install
125-
```
126-
127-
Then, `-DLLVM_DIR` would have to be set to
128-
`<where/you/want/to/build/llvm>/install/lib/cmake/llvm`
129-
and, `-DMLIR_DIR` would have to be set to
130-
`<where/you/want/to/build/llvm>/install/lib/cmake/mlir`
131-
132-
in f18 cmake command.
133-
134-
To run lit tests,
135-
`-DLLVM_EXTERNAL_LIT=<where/you/want/to/build/llvm>/build/bin/llvm-lit` must be
136-
added to f18 cmake command. This is because `llvm-lit` is not part of
137-
LLVM installation.
138-
139-
Note that when using some advanced options from f18 cmake file it may be
140-
necessary to reproduce their effects in LLVM cmake command.
141-
142-
### Building f18 with GCC
83+
### Building flang with GCC
14384

14485
By default,
14586
cmake will search for g++ on your PATH.
14687
The g++ version must be one of the supported versions
147-
in order to build f18.
88+
in order to build flang.
89+
90+
Or, cmake will use the variable CXX to find the C++ compiler. CXX should include
91+
the full path to the compiler or a name that will be found on your PATH, e.g.
92+
g++-8.3, assuming g++-8.3 is on your PATH.
14893

149-
Or,
150-
cmake will use the variable CXX to find the C++ compiler.
151-
CXX should include the full path to the compiler
152-
or a name that will be found on your PATH,
153-
e.g. g++-8.3, assuming g++-8.3 is on your PATH.
15494
```
15595
export CXX=g++-8.3
15696
```
@@ -159,9 +99,9 @@ or
15999
CXX=/opt/gcc-8.3/bin/g++-8.3 cmake ...
160100
```
161101

162-
### Building f18 with clang
102+
### Building flang with clang
163103

164-
To build f18 with clang,
104+
To build flang with clang,
165105
cmake needs to know how to find clang++
166106
and the GCC library and tools that were used to build clang++.
167107

@@ -178,7 +118,7 @@ add
178118
`-DCMAKE_INSTALL_PREFIX=<INSTALL_PREFIX>`
179119
to the cmake command
180120
where `<INSTALL_PREFIX>`
181-
is the path where f18 should be installed.
121+
is the path where flang should be installed.
182122

183123
### Build Types
184124

@@ -194,29 +134,28 @@ add
194134
to the cmake command.
195135
Release builds execute quickly.
196136

197-
### Build F18
137+
### Build Flang out of tree
198138
```
199-
cd ~/f18/build
200-
cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ~/f18/src
139+
cd ~/flang/build
140+
cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ~/flang/src
201141
make
202142
```
203-
204143
### How to Run the Regression Tests
205144

206145
To run all tests:
207146
```
208-
cd ~/f18/build
209-
cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ~/f18/src
147+
cd ~/flang/build
148+
cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ~/flang/src
210149
make test check-all
211150
```
212151

213152
To run individual regression tests llvm-lit needs to know the lit
214-
configuration for f18. The parameters in charge of this are:
153+
configuration for flang. The parameters in charge of this are:
215154
flang_site_config and flang_config. And they can be set as shown bellow:
216155
```
217156
<path-to-llvm-lit>/llvm-lit \
218-
--param flang_site_config=<path-to-f18-build>/test-lit/lit.site.cfg.py \
219-
--param flang_config=<path-to-f18-build>/test-lit/lit.cfg.py \
157+
--param flang_site_config=<path-to-flang-build>/test-lit/lit.site.cfg.py \
158+
--param flang_config=<path-to-flang-build>/test-lit/lit.cfg.py \
220159
<path-to-fortran-test>
221160
```
222161

0 commit comments

Comments
 (0)