annotate flang/README.md @ 248:cfe92afade2b

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 16 Aug 2023 18:23:14 +0900
parents c4bab56944e8
children 1f2b6ac9f198
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 # Flang
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 Flang is a ground-up implementation of a Fortran front end written in modern
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 C++. It started off as the f18 project (https://github.com/flang-compiler/f18)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 with an aim to replace the previous flang project
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 (https://github.com/flang-compiler/flang) and address its various deficiencies.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 F18 was subsequently accepted into the LLVM project and rechristened as Flang.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ## Getting Started
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
11 Read more about flang in the [docs directory](docs).
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
12 Start with the [compiler overview](docs/Overview.md).
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 To better understand Fortran as a language
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 and the specific grammar accepted by flang,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
16 read [Fortran For C Programmers](docs/FortranForCProgrammers.md)
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 and
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
18 flang's specifications of the [Fortran grammar](docs/f2018-grammar.md)
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 and
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
20 the [OpenMP grammar](docs/OpenMP-4.5-grammar.md).
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 Treatment of language extensions is covered
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
23 in [this document](docs/Extensions.md).
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 To understand the compilers handling of intrinsics,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
26 see the [discussion of intrinsics](docs/Intrinsics.md).
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 To understand how a flang program communicates with libraries at runtime,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
29 see the discussion of [runtime descriptors](docs/RuntimeDescriptor.md).
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 If you're interested in contributing to the compiler,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
32 read the [style guide](docs/C++style.md)
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 and
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
34 also review [how flang uses modern C++ features](docs/C++17.md).
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
35
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
36 If you are interested in writing new documentation, follow
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
37 [LLVM's Markdown style guide](https://github.com/llvm/llvm-project/blob/main/llvm/docs/MarkdownQuickstartTemplate.md).
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
38
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
39 ## Building flang
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
40 There are two ways to build flang. The first method is to build it at the same
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
41 time that you build all of the projects on which it depends. This is called
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
42 building in tree. The second method is to first do an in tree build to create
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
43 all of the projects on which flang depends. Then, after creating this base
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
44 build, only build the flang code itself. This is called building standalone.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
45 Building standalone has the advantage of being smaller and faster. Once you
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
46 create the base build and base install areas, you can create multiple
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
47 standalone builds using them.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
48
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
49 Note that instructions for building LLVM can be found at
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
50 https://llvm.org/docs/GettingStarted.html.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
51
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
52 All of the examples below use GCC as the C/C++ compilers and ninja as the build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
53 tool.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
54
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
55 ### Building flang in tree
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
56 Building flang in tree means building flang along with all of the projects on
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
57 which it depends. These projects include mlir, clang, flang, openmp, and
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
58 compiler-rt. Note that compiler-rt is only needed to access libraries that
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
59 support 16 bit floating point numbers. It's not needed to run the automated
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
60 tests. You can use several different C++ compilers for most of the build,
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
61 includig GNU and clang. But building compiler-rt requres using the clang
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
62 compiler built in the initial part of the build.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
63
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
64 Here's a directory structure that works. Create a root directory for the
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
65 cloned and built files. Under that root directory, clone the source code
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
66 into a directory called llvm-project. The build will also
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
67 create subdirectories under the root directory called build (holds most of
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
68 the built files), install (holds the installed files, and compiler-rt (holds
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
69 the result of building compiler-rt).
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
70
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
71 Here's a complete set of commands to clone all of the necessary source and do
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
72 the build.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
73
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
74 First, create the root directory and `cd` into it.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
75 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
76 mkdir root
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
77 cd root
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
78
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
79 Now clone the source:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
80 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
81 git clone https://github.com/llvm/llvm-project.git
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
82 ```
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
83 Once the clone is complete, execute the following commands:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
84 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
85 rm -rf build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
86 mkdir build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
87 rm -rf install
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
88 mkdir install
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
89 ROOTDIR=`pwd`
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
90 INSTALLDIR=$ROOTDIR/install
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
91
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
92 cd build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
93
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
94 cmake \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
95 -G Ninja \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
96 -DCMAKE_BUILD_TYPE=Release \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
97 -DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
98 -DCMAKE_CXX_STANDARD=17 \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
99 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
100 -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
101 -DFLANG_ENABLE_WERROR=ON \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
102 -DLLVM_ENABLE_ASSERTIONS=ON \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
103 -DLLVM_TARGETS_TO_BUILD=host \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
104 -DLLVM_LIT_ARGS=-v \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
105 -DLLVM_ENABLE_PROJECTS="clang;mlir;flang;openmp" \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
106 -DLLVM_ENABLE_RUNTIMES="compiler-rt" \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
107 ../llvm-project/llvm
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
108
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
109 ninja
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
110 ```
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
111
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
112 To run the flang tests on this build, execute the command in the "build"
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
113 directory:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
114 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
115 ninja check-flang
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
116 ```
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
117
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
118 To create the installed files:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
119 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
120 ninja install
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
121
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
122 echo "latest" > $INSTALLDIR/bin/versionrc
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
123 ```
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
124
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
125 To build compiler-rt:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
126 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
127 cd $ROOTDIR
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
128 rm -rf compiler-rt
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
129 mkdir compiler-rt
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
130 cd compiler-rt
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
131 CC=$INSTALLDIR/bin/clang \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
132 CXX=$INSTALLDIR/bin/clang++ \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
133 cmake \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
134 -G Ninja \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
135 ../llvm-project/compiler-rt \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
136 -DCMAKE_BUILD_TYPE=Release \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
137 -DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
138 -DCMAKE_CXX_STANDARD=11 \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
139 -DCMAKE_C_CFLAGS=-mlong-double-128 \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
140 -DCMAKE_CXX_CFLAGS=-mlong-double-128 \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
141 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
142 -DCOMPILER_RT_BUILD_ORC=OFF \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
143 -DCOMPILER_RT_BUILD_XRAY=OFF \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
144 -DCOMPILER_RT_BUILD_MEMPROF=OFF \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
145 -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
146 -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
147 -DLLVM_CONFIG_PATH=$INSTALLDIR/bin/llvm-config
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
148
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
149 ninja
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
150 ninja install
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
151 ```
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
152
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
153 Note that these instructions specify flang as one of the projects to build in
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
154 the in tree build. This is not strictly necessary for subsequent standalone
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
155 builds, but doing so lets you run the flang tests to verify that the source
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
156 code is in good shape.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
157 ### Building flang standalone
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
158 To do the standalone build, start by building flang in tree as described above.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
159 This build is base build for subsequent standalone builds. Start each
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
160 standalone build the same way by cloning the source for llvm-project:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
161 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
162 mkdir standalone
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
163 cd standalone
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
164 git clone https://github.com/llvm/llvm-project.git
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
165 ```
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
166 Once the clone is complete, execute the following commands:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
167 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
168 cd llvm-project/flang
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
169 rm -rf build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
170 mkdir build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
171 cd build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
172
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
173 cmake \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
174 -G Ninja \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
175 -DCMAKE_BUILD_TYPE=Release \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
176 -DCMAKE_CXX_STANDARD=17 \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
177 -DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
178 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
179 -DFLANG_ENABLE_WERROR=ON \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
180 -DLLVM_TARGETS_TO_BUILD=host \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
181 -DLLVM_ENABLE_ASSERTIONS=ON \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
182 -DLLVM_BUILD_MAIN_SRC_DIR=$ROOTDIR/build/lib/cmake/llvm \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
183 -DLLVM_EXTERNAL_LIT=$ROOTDIR/build/bin/llvm-lit \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
184 -DLLVM_LIT_ARGS=-v \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
185 -DLLVM_DIR=$ROOTDIR/build/lib/cmake/llvm \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
186 -DCLANG_DIR=$ROOTDIR/build/lib/cmake/clang \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
187 -DMLIR_DIR=$ROOTDIR/build/lib/cmake/mlir \
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
188 ..
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
189
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
190 ninja
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
191 ```
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
192
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
193 To run the flang tests on this build, execute the command in the "flang/build"
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
194 directory:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
195 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
196 ninja check-flang
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
197 ```
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 ## Supported C++ compilers
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 Flang is written in C++17.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 The code has been compiled and tested with
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 GCC versions from 7.2.0 to 9.3.0.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 The code has been compiled and tested with
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 clang version 7.0, 8.0, 9.0 and 10.0
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 using either GNU's libstdc++ or LLVM's libc++.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
209
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 The code has been compiled on
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 AArch64, x86\_64 and ppc64le servers
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 with CentOS7, Ubuntu18.04, Rhel, MacOs, Mojave, XCode and
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 Apple Clang version 10.0.1.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
214
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 ### Building flang with GCC
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 By default,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 cmake will search for g++ on your PATH.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 The g++ version must be one of the supported versions
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 in order to build flang.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 Or, cmake will use the variable CXX to find the C++ compiler. CXX should include
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 the full path to the compiler or a name that will be found on your PATH, e.g.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 g++-8.3, assuming g++-8.3 is on your PATH.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
225
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
226 ```bash
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 export CXX=g++-8.3
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 ```
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 or
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
230 ```bash
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 CXX=/opt/gcc-8.3/bin/g++-8.3 cmake ...
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 ```
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 ### Building flang with clang
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
235
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 To build flang with clang,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 cmake needs to know how to find clang++
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 and the GCC library and tools that were used to build clang++.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 CXX should include the full path to clang++
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 or clang++ should be found on your PATH.
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
242 ```bash
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 export CXX=clang++
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 ```
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 ### Installation Directory
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 To specify a custom install location,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 add
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 `-DCMAKE_INSTALL_PREFIX=<INSTALL_PREFIX>`
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 to the cmake command
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 where `<INSTALL_PREFIX>`
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 is the path where flang should be installed.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
254
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 ### Build Types
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
256
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 To create a debug build,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 add
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 `-DCMAKE_BUILD_TYPE=Debug`
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 to the cmake command.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 Debug builds execute slowly.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
262
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 To create a release build,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 add
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 `-DCMAKE_BUILD_TYPE=Release`
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 to the cmake command.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 Release builds execute quickly.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
268
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
269 # How to Run Tests
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
270
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
271 Flang supports 2 different categories of tests
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
272 1. Regression tests (https://www.llvm.org/docs/TestingGuide.html#regression-tests)
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
273 2. Unit tests (https://www.llvm.org/docs/TestingGuide.html#unit-tests)
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
274
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
275 ## For standalone builds
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 To run all tests:
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
277 ```bash
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 cd ~/flang/build
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 cmake -DLLVM_DIR=$LLVM -DMLIR_DIR=$MLIR ~/flang/src
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
280 ninja check-all
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 ```
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
282
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 To run individual regression tests llvm-lit needs to know the lit
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 configuration for flang. The parameters in charge of this are:
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
285 flang_site_config and flang_config. And they can be set as shown below:
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
286 ```bash
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 <path-to-llvm-lit>/llvm-lit \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 --param flang_site_config=<path-to-flang-build>/test-lit/lit.site.cfg.py \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 --param flang_config=<path-to-flang-build>/test-lit/lit.cfg.py \
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 <path-to-fortran-test>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
291
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
292 ```
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
293
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
294 Unit tests:
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
295
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
296 If flang was built with `-DFLANG_INCLUDE_TESTS=ON` (`ON` by default), it is possible to generate unittests.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
297 Note: Unit-tests will be skipped for LLVM install for an standalone build as it does not include googletest related headers and libraries.
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
298
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
299 There are various ways to run unit-tests.
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
300
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
301 ```
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
302
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
303 1. ninja check-flang-unit
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
304 2. ninja check-all or ninja check-flang
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
305 3. <path-to-llvm-lit>/llvm-lit \
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
306 test/Unit
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
307 4. Invoking tests from <standalone flang build>/unittests/<respective unit test folder>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
308
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
309 ```
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
310
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
311
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
312 ## For in tree builds
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
313 If flang was built with `-DFLANG_INCLUDE_TESTS=ON` (`ON` by default), it is possible to
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
314 generate unittests.
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
315
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
316 To run all of the flang unit tests use the `check-flang-unit` target:
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
317 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
318 ninja check-flang-unit
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
319 ```
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
320 To run all of the flang regression tests use the `check-flang` target:
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
321 ```bash
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
322 ninja check-flang
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 ```
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
324
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 # How to Generate Documentation
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
326
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 ## Generate FIR Documentation
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
328 If flang was built with `-DLINK_WITH_FIR=ON` (`ON` by default), it is possible to
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
329 generate FIR language documentation by running `ninja flang-doc`. This will
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 create `docs/Dialect/FIRLangRef.md` in flang build directory.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
331
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 ## Generate Doxygen-based Documentation
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 To generate doxygen-style documentation from source code
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 - Pass `-DLLVM_ENABLE_DOXYGEN=ON -DFLANG_INCLUDE_DOCS=ON` to the cmake command.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
335
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
336 ```bash
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 cd ~/llvm-project/build
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 cmake -DLLVM_ENABLE_DOXYGEN=ON -DFLANG_INCLUDE_DOCS=ON ../llvm
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
339 ninja doxygen-flang
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
340 ```
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
341
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 It will generate html in
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
343
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
344 ```bash
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 <build-dir>/tools/flang/docs/doxygen/html # for flang docs
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 ```
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
347 ## Generate Sphinx-based Documentation
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
348 <!TODO: Add webpage once we have a website.
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
349 !>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
350 Flang documentation should preferably be written in `markdown(.md)` syntax (they can be in `reStructuredText(.rst)` format as well but markdown is recommended in first place), it
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
351 is mostly meant to be processed by the Sphinx documentation generation
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
352 system to create HTML pages which would be hosted on the webpage of flang and
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
353 updated periodically.
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
354
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
355 If you would like to generate and view the HTML locally:
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
356 - Install [Sphinx](http://sphinx-doc.org/), including the [sphinx-markdown-tables](https://pypi.org/project/sphinx-markdown-tables/) extension.
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
357 - Pass `-DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF` to the cmake command.
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
358
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
359 ```bash
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
360 cd ~/llvm-project/build
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
361 cmake -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF ../llvm
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
362 ninja docs-flang-html
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
363 ```
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
364
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
365 It will generate html in
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
366
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
367 ```bash
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
368 $BROWSER <build-dir>/tools/flang/docs/html/
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
369 ```