Is there a compiler driver program provided?
dmikushin opened this issue · 5 comments
Turns out, flang1 and flang2 are two internal stages, similar to cc1. I don't see any user-level driver (such as gcc) being a part of this repository. Even a help message with an options description does not seem to exist. Is it all what you intend to provide, or is there anything else what I'm missing?
flang1 and flang2 work well, as shown below, and could be piped down to the LLVM backends:
marcusmae@predator ~/f/f/c/s/c/check (master)> ../../../install/bin/flang1 check.f90 | tee check.ilm
ENDINLINE
TOILM version 1/55
I:0
S:643
D:57
B:0
G:0
L:0
S:1
L:1
P:0
fihx:0 tag:0 parent:0 flags:0 lineno:0 srcline:0 level:0 next:0 0: 0: 0: 0:
fihx:1 tag:0 parent:0 flags:0 lineno:1 srcline:1 level:0 next:0 0: 9:check.f90 5:check 9:check.f90
procedure:Program
d:6 I4
s:622 c n d:6 h- 0 0:
s:624 c n d:6 h- 1 0:
s:637 E E d:0 c+ a- a- a:0 C- d- d:0 c:0 e:2 i:0 l:1 m- p- r- e- r:0 p- p- s- d- c- n- c:0 r:0 p:0 a:0 v:0 i:0 i- c- d- a- v- h- 5:check
s:640 L n d:0 c+ a- f- v- r:0 a:0 7:%L99999
s:642 c n d:6 h- 7fffffff 0:
s:643 P E d:0 a:0 c+ d- d:0 d- c:0 f- i:0 m- n- p- r- p- p- c- s+ s- d- c- n- t- r- r:0 C- u- i- r:0 p:0 v:0 i:0 i- c- m- c- i- c- f- a- v- h- p- i- a:0 p:0 p- 9:fort_init
end
AST2ILM version 1/55
i0: BOS l1 n1 n0
i4: NOP
i5: --------------------
i0: BOS l1 n1 n0
i4: ICON s622
i6: CALL n1 s643 i4
i10: --------------------
i0: BOS l0 n1 n0
i4: ENLAB
i5: --------------------
i0: BOS l2 n1 n0
i4: LABEL s640
i6: --------------------
i0: BOS l2 n1 n0
i4: FILE n2 n1 n1000
i8: END
i9: --------------------
end
DIRECTIVES version 1/55
A:1
rou: --------------------
z
end
marcusmae@predator ~/f/f/c/s/c/check (master)> ../../../install/bin/flang2 check.ilm
; ModuleID = 'check.ilm'
target datalayout = "e-p:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@.C310_MAIN_ = internal constant i32 0
define void @MAIN_() noinline {
L.entry:
call ptr @fort_init (ptr @.C310_MAIN_)
br label %L.LB1_334
L.LB1_334:
ret void
}
; Named metadata
; Metadata
!1 = metadata !{ }
declare void @fort_init(...) noinline
The driver is in the classic-flang-llvm-project
repository. https://github.com/flang-compiler/classic-flang-llvm-project
There is no intention to provide a driver in this repo.
Some docs are available in https://github.com/flang-compiler/flang/wiki/Introduction-to-Flang
Thanks for the docs, but I don't understand. And I have a growing feeling that those who answer me here don't understand much either.
This project is a legacy of PGI. I see PGI macros are still here in the source, even some ashes of FLEXLM license manager are still here. We all know how the PGI compiler driver looks like, what options it has, such as -Minfo, -Maccel and so on. Do you mean that now it has to play with the in-tree LLVM flang somehow? This is totally weird, because in-tree Flang has no connection to PGI, and follows LLVM's own options.
This can't be true, because classic-flang-llvm-project does not provide support for PGI-specific compiler options used in CMake by this project, such as -Mreentrant and others such as -no-flang-libs:
marcusmae@predator ~/f/f/c/s/c/runtime (master)> grep "flang-libs" * -R
flang/CMakeLists.txt: SET(CMAKE_SHARED_LINKER_FLAGS "-no-flang-libs")
flang/CMakeLists.txt: SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-flang-libs")
marcusmae@predator ~/f/f/c/s/classic-flang-llvm-project (release_16x)> grep "flang-libs" * -R
marcusmae@predator ~/f/f/c/s/classic-flang-llvm-project (release_16x)>
The driver for classic flang is in the clang
folder. https://github.com/flang-compiler/classic-flang-llvm-project/blob/release_15x/clang/lib/Driver/ToolChains/ClassicFlang.cpp
For the specific flag you are mentioning it is here : https://github.com/flang-compiler/classic-flang-llvm-project/blob/cd736e11b188a8f6ff14041abd818ad86f36b9bb/clang/lib/Driver/ToolChains/ClassicFlang.cpp#L205
Thanks, I've figured out that needed options are implemented in release_15x
branch, but not in release_16x
.
Sorry!