1
- <!-- ===- README.md
1
+ # Flang
2
2
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.
17
8
18
9
## Getting Started
19
10
20
- Read more about f18 in the [ documentation directory] ( documentation ) .
11
+ Read more about flang in the [ documentation directory] ( documentation ) .
21
12
Start with the [ compiler overview] ( documentation/Overview.md ) .
22
13
23
14
To better understand Fortran as a language
24
- and the specific grammar accepted by f18 ,
15
+ and the specific grammar accepted by flang ,
25
16
read [ Fortran For C Programmers] ( documentation/FortranForCProgrammers.md )
26
17
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 )
28
19
and
29
20
the [ OpenMP grammar] ( documentation/OpenMP-4.5-grammar.txt ) .
30
21
@@ -34,49 +25,52 @@ in [this document](documentation/Extensions.md).
34
25
To understand the compilers handling of intrinsics,
35
26
see the [ discussion of intrinsics] ( documentation/Intrinsics.md ) .
36
27
37
- To understand how an f18 program communicates with libraries at runtime,
28
+ To understand how a flang program communicates with libraries at runtime,
38
29
see the discussion of [ runtime descriptors] ( documentation/RuntimeDescriptor.md ) .
39
30
40
31
If you're interested in contributing to the compiler,
41
32
read the [ style guide] ( documentation/C++style.md )
42
33
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 ) .
44
35
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
53
37
54
- ### Supported C++ compilers
55
-
56
- F18 is written in C++17.
38
+ Flang is written in C++17.
57
39
58
40
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.
60
42
61
43
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
63
45
using either GNU's libstdc++ or LLVM's libc++.
64
46
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.
66
51
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
68
61
69
62
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 ` .
71
65
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 .
73
67
74
- The f18 CMakeList.txt file uses
68
+ The flang CMakeList.txt file uses
75
69
the variable ` LLVM_DIR ` to find the installed LLVM components
76
70
and
77
71
the variable ` MLIR_DIR ` to find the installed MLIR components.
78
72
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,
80
74
define LLVM_DIR and MLIR_DIR on the cmake command line.
81
75
```
82
76
LLVM=<LLVM_BUILD_DIR>/lib/cmake/llvm \
@@ -86,71 +80,17 @@ cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ...
86
80
where ` LLVM_BUILD_DIR ` is
87
81
the top-level directory where LLVM was built.
88
82
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
143
84
144
85
By default,
145
86
cmake will search for g++ on your PATH.
146
87
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.
148
93
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.
154
94
```
155
95
export CXX=g++-8.3
156
96
```
159
99
CXX=/opt/gcc-8.3/bin/g++-8.3 cmake ...
160
100
```
161
101
162
- ### Building f18 with clang
102
+ ### Building flang with clang
163
103
164
- To build f18 with clang,
104
+ To build flang with clang,
165
105
cmake needs to know how to find clang++
166
106
and the GCC library and tools that were used to build clang++.
167
107
178
118
` -DCMAKE_INSTALL_PREFIX=<INSTALL_PREFIX> `
179
119
to the cmake command
180
120
where ` <INSTALL_PREFIX> `
181
- is the path where f18 should be installed.
121
+ is the path where flang should be installed.
182
122
183
123
### Build Types
184
124
@@ -194,29 +134,28 @@ add
194
134
to the cmake command.
195
135
Release builds execute quickly.
196
136
197
- ### Build F18
137
+ ### Build Flang out of tree
198
138
```
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
201
141
make
202
142
```
203
-
204
143
### How to Run the Regression Tests
205
144
206
145
To run all tests:
207
146
```
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
210
149
make test check-all
211
150
```
212
151
213
152
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:
215
154
flang_site_config and flang_config. And they can be set as shown bellow:
216
155
```
217
156
<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 \
220
159
<path-to-fortran-test>
221
160
```
222
161
0 commit comments