Tracking issue: #201242 See the [migration guide] for more information. [migration guide]: https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines This is a stacked PR based on #210208, which is the standalone rename commit for this miscellaneous Markdown migration batch. This was prepared with rst2myst plus LLM-assisted cleanup. LLDB man pages are intentionally left as reStructuredText because LLDB man-page building should not take on Markdown parser dependencies. Unfortunately, many of these miscellaneous docs do not have working standalone doc build targets, so I was not able to render HTML for all of them. I think the scope is small enough that this is reviewable by hand.
2.3 KiB
flang - the Flang Fortran compiler
SYNOPSIS
{program}flang [options] filename ...
DESCRIPTION
{program}flang is a Fortran compiler which supports all of the Fortran 95 and
many newer language features. Flang supports OpenMP and has some support for
OpenACC and CUDA. It encompasses preprocessing, parsing, optimization, code
generation, assembly, and linking. Depending on the options passed in, Flang
will perform only some, or all, of these actions. While Flang is highly
integrated, it is important to understand the stages of compilation in order to
understand how to invoke it. These stages are:
- Driver
-
The flang executable is actually a small driver that orchestrates the execution of other tools such as the compiler, assembler and linker. Typically you do not need to interact with the driver, but you transparently use it to run the other tools.
- Preprocessing
-
This stage performs tokenization of the input source file, macro expansion, #include expansion and handles other preprocessor directives.
- Parsing and Semantic Analysis
-
This stage parses the input file, translating preprocessor tokens into a parse tree. Once in the form of a parse tree, it applies semantic analysis to compute types for expressions and determine whether the code is well formed. Parse errors and most compiler warnings are generated by this stage.
- Code Generation and Optimization
-
This stage translates the parse tree into intermediate code (known as "LLVM IR") and, ultimately, machine code. It also optimizes this intermediate code and handles target-specific code generation. The output of this stage is typically a ".s" file, referred to as an "assembly" file.
Flang also supports the use of an integrated assembler, in which the code generator produces object files directly. This avoids the overhead of generating the ".s" file and calling the target assembler explicitly.
- Assembler
-
This stage runs the target assembler to translate the output of the compiler into a target object file. The output of this stage is typically a ".o" file, referred to as an "object" file.
- Linker
-
This stage runs the target linker to merge multiple object files into an executable or dynamic library. The output of this stage is typically an "a.out", ".dylib" or ".so" file.
OPTIONS
:::{toctree} :maxdepth: 1
FlangCommandLineOptions :::