64 lines · plain
1flang - the Flang Fortran compiler2==================================3 4SYNOPSIS5--------6 7:program:`flang` [*options*] *filename ...*8 9DESCRIPTION10-----------11 12:program:`flang` is a Fortran compiler which supports all of the Fortran 95 and13many newer language features. Flang supports OpenMP and has some support for14OpenACC and CUDA. It encompasses preprocessing, parsing, optimization, code15generation, assembly, and linking. Depending on the options passed in, Flang16will perform only some, or all, of these actions. While Flang is highly17integrated, it is important to understand the stages of compilation in order to18understand how to invoke it. These stages are:19 20Driver21 The flang executable is actually a small driver that orchestrates the22 execution of other tools such as the compiler, assembler and linker.23 Typically you do not need to interact with the driver, but you24 transparently use it to run the other tools.25 26Preprocessing27 This stage performs tokenization of the input source file, macro expansion,28 #include expansion and handles other preprocessor directives.29 30Parsing and Semantic Analysis31 This stage parses the input file, translating preprocessor tokens into a32 parse tree. Once in the form of a parse tree, it applies semantic33 analysis to compute types for expressions and determine whether34 the code is well formed. Parse errors and most compiler warnings35 are generated by this stage.36 37Code Generation and Optimization38 This stage translates the parse tree into intermediate code (known as39 "LLVM IR") and, ultimately, machine code. It also optimizes this40 intermediate code and handles target-specific code generation. The output41 of this stage is typically a ".s" file, referred to as an "assembly" file.42 43 Flang also supports the use of an integrated assembler, in which the code44 generator produces object files directly. This avoids the overhead of45 generating the ".s" file and calling the target assembler explicitly.46 47Assembler48 This stage runs the target assembler to translate the output of the49 compiler into a target object file. The output of this stage is typically50 a ".o" file, referred to as an "object" file.51 52Linker53 This stage runs the target linker to merge multiple object files into an54 executable or dynamic library. The output of this stage is typically55 an "a.out", ".dylib" or ".so" file.56 57OPTIONS58-------59 60.. toctree::61 :maxdepth: 162 63 FlangCommandLineOptions64