#
5d15f606 |
| 24-Jun-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang][preprocessing] Mix preprocessing directives with free form li… (#96244)
…ne continuation
Allow preprocessing directives to appear between a source line and its
continuation, including co
[flang][preprocessing] Mix preprocessing directives with free form li… (#96244)
…ne continuation
Allow preprocessing directives to appear between a source line and its
continuation, including conditional compilation directives (#if, #ifdef,
&c.).
Fixes https://github.com/llvm/llvm-project/issues/95476.
show more ...
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2 |
|
#
aa26faf0 |
| 08-Mar-2024 |
Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com> |
[flang][unittests] Fix buffer overrun in FrontendActionTest (#84381)
When` SmallVector<char>` is used as a backing storage, it can't be
assumed to end with a \x0. When creating a `StringRef` from i
[flang][unittests] Fix buffer overrun in FrontendActionTest (#84381)
When` SmallVector<char>` is used as a backing storage, it can't be
assumed to end with a \x0. When creating a `StringRef` from it, pass the
length explicitly.
This was detected by address sanitizer.
show more ...
|
Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init |
|
#
11efccea |
| 14-Dec-2023 |
Kazu Hirata <kazu@google.com> |
[flang] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,en
[flang] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20.
I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
show more ...
|
#
e59e8488 |
| 06-Dec-2023 |
jeanPerier <jperier@nvidia.com> |
[flang] Updating drivers to create data layout before semantics (#73301)
Preliminary patch to change lowering/code generation to use
llvm::DataLayout information instead of generating "sizeof" GEP
[flang] Updating drivers to create data layout before semantics (#73301)
Preliminary patch to change lowering/code generation to use
llvm::DataLayout information instead of generating "sizeof" GEP (see
https://github.com/llvm/llvm-project/issues/71507).
Fortran Semantic analysis needs to know about the target type size and
alignment to deal with common blocks, and intrinsics like
C_SIZEOF/TRANSFER. This information should be obtained from the
llvm::DataLayout so that it is consistent during the whole compilation
flow.
This change is changing flang-new and bbc drivers to:
1. Create the llvm::TargetMachine so that the data layout of the target
can be obtained before semantics.
2. Sharing bbc/flang-new set-up of the
SemanticConstext.targetCharateristics from the llvm::TargetMachine. For
now, the actual part that set-up the Fortran type size and alignment
from the llvm::DataLayout is left TODO so that this change is mostly an
NFC impacting the drivers.
3. Let the lowering bridge set-up the mlir::Module datalayout attributes
since it is doing it for the target attribute, and that allows the llvm
data layout information to be available during lowering.
For flang-new, the changes are code shuffling: the `llvm::TargetMachine`
instance is moved to `CompilerInvocation` class so that it can be used
to set-up the semantic contexts. `setMLIRDataLayout` is moved to
`flang/Optimizer/Support/DataLayout.h` (it will need to be used from
codegen pass for fir-opt target independent testing.)), and the code
setting-up semantics targetCharacteristics is moved to
`Tools/TargetSetup.h` so that it can be shared with bbc.
As a consequence, LLVM targets must be registered when running
semantics, and it is not possible to run semantics for a target that is
not registered with the -triple option (hence the power pc specific
modules can only be built if the PowerPC target is available.
show more ...
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3 |
|
#
d768bf99 |
| 10-Feb-2023 |
Archibald Elliott <archibald.elliott@arm.com> |
[NFC][TargetParser] Replace uses of llvm/Support/Host.h
The forwarding header is left in place because of its use in `polly/lib/External/isl/interface/extract_interface.cc`, but I have added a GCC w
[NFC][TargetParser] Replace uses of llvm/Support/Host.h
The forwarding header is left in place because of its use in `polly/lib/External/isl/interface/extract_interface.cc`, but I have added a GCC warning about the fact it is deprecated, because it is used in `isl` from where it is included by Polly.
show more ...
|
Revision tags: llvmorg-16.0.0-rc2 |
|
#
62c7f035 |
| 07-Feb-2023 |
Archibald Elliott <archibald.elliott@arm.com> |
[NFC][TargetParser] Remove llvm/ADT/Triple.h
I also ran `git clang-format` to get the headers in the right order for the new location, which has changed the order of other headers in two files.
|
Revision tags: llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0 |
|
#
81181089 |
| 02-Sep-2022 |
Mats Petersson <mats.petersson@arm.com> |
[Flang][Driver]Add datalayout before doing LLVM-IR transformation
The earlier available datalyaout allows MLIR to LLVM-IR transformation to use the datalayout for decisions, such as comparing sizes
[Flang][Driver]Add datalayout before doing LLVM-IR transformation
The earlier available datalyaout allows MLIR to LLVM-IR transformation to use the datalayout for decisions, such as comparing sizes for different types of integers.
This should solve https://github.com/llvm/llvm-project/issues/57230
Reviewed By: awarzynski, vzakhari
Differential Revision: https://reviews.llvm.org/D133568
show more ...
|
Revision tags: llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4 |
|
#
1e462faf |
| 29-Apr-2022 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Switch to the MLIR coding style in the driver (nfc)
This patch re-factors the driver code in LLVM Flang (frontend + compiler) to use the MLIR style. For more context, please see: htt
[flang][driver] Switch to the MLIR coding style in the driver (nfc)
This patch re-factors the driver code in LLVM Flang (frontend + compiler) to use the MLIR style. For more context, please see: https://discourse.llvm.org/t/rfc-coding-style-in-the-driver/
Most changes here are rather self-explanatory. Accessors are renamed to be more consistent with the rest of LLVM (e.g. allSource --> getAllSources). Additionally, MLIR clang-tidy files are added in the affected directories.
clang-tidy and clang-format files were copied from MLIR. Small additional changes are made to silence clang-tidy/clang-format warnings.
[1] https://mlir.llvm.org/getting_started/DeveloperGuide/
Differential Revision: https://reviews.llvm.org/D125007
show more ...
|
Revision tags: llvmorg-14.0.3 |
|
#
02fb5b77 |
| 28-Apr-2022 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Define the default frontend driver triple
*SUMMARY* Currently, the frontend driver assumes that a target triple is either: * provided by the frontend itself (e.g. when lowering and
[flang][driver] Define the default frontend driver triple
*SUMMARY* Currently, the frontend driver assumes that a target triple is either: * provided by the frontend itself (e.g. when lowering and generating code), * specified through the `-triple/-target` command line flags.
If `-triple/-target` is not used, the frontend will simply use the host triple.
This is going to be insufficient when e.g. consuming an LLVM IR file that has no triple specified (reading LLVM files is WIP, see D124667). We shouldn't require the triple to be specified via the command line in such situation. Instead, the frontend driver should contain a good default, e.g. the host triple.
This patch updates Flang's `CompilerInvocation` to do just that, i.e. defines its default target triple. Similarly to Clang: * the default `CompilerInvocation` triple is set as the host triple, * the value specified with `-triple` takes precedence over the frontend driver default and the current module triple, * the frontend driver default takes precedence over the module triple.
*TESTS* This change requires 2 unit tests to be updated. That's because relevant frontend actions are updated to assume that there's always a valid triple available in the current `CompilerInvocation`. This update is required because the unit tests bypass the regular `CompilerInvocation` set-up (in particular, they don't call `CompilerInvocation::CreateFromArgs`). I've also taken the liberty to disable the pre-precossor formatting in the affected unit tests as well (it is not required).
No new tests are added. As `flang-new -fc1` does not support consuming LLVM IR files just yet, it is not possible to compile an LLVM IR file without a triple. More specifically, atm all LLVM IR files are generated and stored internally and the driver makes sure that these contain a valid target triple. This is about to change in D124667 (which adds support for reading LLVM IR/BC files) and that's where tests for exercising the default frontend driver triple will be added.
*WHAT DOES CLANG DO?* For reference, the default target triple for Clang's `CompilerInvocation` is set through option marshalling infra [1] in Options.td. Please check the definition of the `-triple` flag: ``` def triple : Separate<["-"], "triple">, HelpText<"Specify target triple (e.g. i686-apple-darwin9)">, MarshallingInfoString<TargetOpts<"Triple">, "llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple())">, AlwaysEmit, Normalizer<"normalizeTriple">; ``` Ideally, we should re-use the marshalling infra in Flang.
[1] https://clang.llvm.org/docs/InternalsManual.html#option-marshalling-infrastructure
Differential Revision: https://reviews.llvm.org/D124664
show more ...
|
Revision tags: llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2 |
|
#
38101b4e |
| 24-Feb-2022 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Add support for -S and implement -c/-emit-obj
This patch adds support for: * `-S` in Flang's compiler and frontend drivers, and implements: * `-emit-obj` in Flang's frontend driv
[flang][driver] Add support for -S and implement -c/-emit-obj
This patch adds support for: * `-S` in Flang's compiler and frontend drivers, and implements: * `-emit-obj` in Flang's frontend driver and `-c` in Flang's compiler driver (this is consistent with Clang). (these options were already available before, but only as placeholders). The semantics of these options in Clang and Flang are identical.
The `EmitObjAction` frontend action is renamed as `BackendAction`. This new name more accurately reflects the fact that this action will primarily run the code-gen/backend pipeline in LLVM. It also makes more sense as an action implementing both `-emit-obj` and `-S` (originally, it was just `-emit-obj`).
`tripleName` from FirContext.cpp is deleted and, when a target triple is required, `mlir::LLVM::LLVMDialect::getTargetTripleAttrName()` is used instead. In practice, this means that `fir.triple` is replaced with `llvm.target_triple`. The former was effectively ignored. The latter is used when lowering from the LLVM dialect in MLIR to LLVM IR (i.e. it's embedded in the generated LLVM IR module). The driver can then re-use it when configuring the backend. With this change, the LLVM IR files generated by e.g. `tco` will from now on contain the correct target triple.
The code-gen.f90 test is replaced with code-gen-x86.f90 and code-gen-aarch64.f90. With 2 seperate files we can verify that `--target` is correctly taken into account. LIT configuration is updated to enable e.g.: ``` ! REQUIRES: aarch64-registered-target ```
Differential Revision: https://reviews.llvm.org/D120568
show more ...
|
Revision tags: llvmorg-14.0.0-rc1 |
|
#
e993b20c |
| 04-Feb-2022 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Add support for `-emit-llvm`
This patch adds support for the `-emit-llvm` option in the frontend driver (i.e. `flang-new -fc1`). Similarly to Clang, `flang-new -fc1 -emit-llvm file.f
[flang][driver] Add support for `-emit-llvm`
This patch adds support for the `-emit-llvm` option in the frontend driver (i.e. `flang-new -fc1`). Similarly to Clang, `flang-new -fc1 -emit-llvm file.f` will generate a textual LLVM IR file.
Depends on D118985
Differential Revision: https://reviews.llvm.org/D119012
show more ...
|
Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1 |
|
#
23d4c4f3 |
| 29-Jul-2021 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions`
As all member variables in `FrontendOptions` and `PreprocessorOptions` are public, we should be naming them as `variable`
[flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions`
As all member variables in `FrontendOptions` and `PreprocessorOptions` are public, we should be naming them as `variable` rather than `variable_` [1]. This patch fixes that.
Also, `FrontendOptions` & `PreprocessorOptions` are re-defined as a structs rather than classes (all fields are meant to be public).
[1] https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md#naming
Differential Revision: https://reviews.llvm.org/D107062
show more ...
|
Revision tags: llvmorg-14-init |
|
#
3338ef93 |
| 23-Jul-2021 |
peter klausler <pklausler@nvidia.com> |
[flang] Produce proper "preprocessor output" for -E option
Rename the current -E option to "-E -Xflang -fno-reformat".
Add a new Parsing::EmitPreprocessedSource() routine to convert the cooked char
[flang] Produce proper "preprocessor output" for -E option
Rename the current -E option to "-E -Xflang -fno-reformat".
Add a new Parsing::EmitPreprocessedSource() routine to convert the cooked character stream output of the prescanner back to something more closely resembling output from a traditional preprocessor; call this new routine when -E appears.
The new -E output is suitable for use as fixed form Fortran source to compilation by (one hopes) any Fortran compiler. If the original top-level source file had been free form source, the output will be suitable for use as free form source as well; otherwise there may be diagnostics about missing spaces if they were indeed absent in the original fixed form source.
Unless the -P option appears, #line directives are interspersed with the output (but be advised, f18 will ignore these if presented with them in a later compilation).
An effort has been made to preserve original alphabetic character case and source indentation.
Add -P and -fno-reformat to the new drivers.
Tweak test options to avoid confusion with prior -E output; use -fno-reformat where needed, but prefer to keep -E, sometimes in concert with -P, on most, updating expected results accordingly.
Differential Revision: https://reviews.llvm.org/D106727
show more ...
|
Revision tags: llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init |
|
#
6110e771 |
| 26-Jan-2021 |
peter klausler <pklausler@nvidia.com> |
[flang] Search for #include "file" in right directory (take 2)
Make the #include "file" preprocessing directive begin its search in the same directory as the file containing the directive, as other
[flang] Search for #include "file" in right directory (take 2)
Make the #include "file" preprocessing directive begin its search in the same directory as the file containing the directive, as other preprocessors and our Fortran INCLUDE statement do.
Avoid current working directory for all source files except the original.
Resolve tests.
Differential Revision: https://reviews.llvm.org/D95481
show more ...
|
Revision tags: llvmorg-11.1.0-rc2 |
|
#
b564b12b |
| 20-Jan-2021 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Refactor one unit-test case to use fixtures (nfc)
Move the unit test from InputOutputTest.cpp to FrontendActionTest.cpp and re-implement it in terms of the FrontendActionTest fixture
[flang][driver] Refactor one unit-test case to use fixtures (nfc)
Move the unit test from InputOutputTest.cpp to FrontendActionTest.cpp and re-implement it in terms of the FrontendActionTest fixture. This is just a small code clean-up and a continuation of: * https://reviews.llvm.org/D93544
Moving forward, we should try be implementing all unit-test cases for Flang's frontend actions in terms of FrontendActionTest.
Reviewed By: sameeranjoshi
Differential Revision: https://reviews.llvm.org/D94922
show more ...
|
Revision tags: llvmorg-11.1.0-rc1 |
|
#
443d6957 |
| 04-Jan-2021 |
Faris Rehman <faris.rehman@arm.com> |
[flang][driver] Add support for fixed form detection
Currently the new flang driver always runs in free form mode. This patch adds support for fixed form mode detection based on the file extensions.
[flang][driver] Add support for fixed form detection
Currently the new flang driver always runs in free form mode. This patch adds support for fixed form mode detection based on the file extensions.
Like `f18`, `flang-new` will treat files ending with ".f", ".F" and ".ff" as fixed form. Additionally, ".for", ".FOR", ".fpp" and ".FPP" file extensions are recognised as fixed form files. This is consistent with gfortran [1]. In summary, files with the following extensions are treated as fixed-form: * ".f", ".F", ".ff", ".for", ".FOR", ".fpp", ".FPP"
For consistency with flang/test/lit.cfg.py and f18, this patch also adds support for the following file extensions: * ".ff", ".FOR", ".for", ".ff90", ".fpp", ".FPP" This is added in flang/lib/Frontend/FrontendOptions.cpp. Additionally, the following extensions are included: * ".f03", ".F03", ".f08", ".F08" This is for compatibility with gfortran [1] and other popular Fortran compilers [2].
NOTE: internally Flang will only differentiate between fixed and free form files. Currently Flang does not support switching between language standards, so in this regard file extensions are irrelevant. More specifically, both `file.f03` and `file.f18` are represented with `Language::Fortran` (as opposed to e.g. `Language::Fortran03`).
Summary of changes: - Set Fortran::parser::Options::sFixedForm according to the file type - Add isFixedFormSuffix and isFreeFormSuffix helper functions to FrontendTool/Utils.h - Change FrontendOptions::GetInputKindForExtension to support the missing file extensions that f18 supports and some additional ones - FrontendActionTest.cpp is updated to make sure that the test input is treated as free-form
[1] https://gcc.gnu.org/onlinedocs/gfortran/GNU-Fortran-and-GCC.html [2] https://github.com/llvm/llvm-project/blob/master/flang/docs/OptionComparison.md#notes
Differential Revision: https://reviews.llvm.org/D94228
show more ...
|
#
44e74c75 |
| 22-Dec-2020 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Refactor unit tests for frontend actions (nfc)
These patch implements a few non-functional-changes: * switch to using test fixtures for better code sharing * rename some variable
[flang][driver] Refactor unit tests for frontend actions (nfc)
These patch implements a few non-functional-changes: * switch to using test fixtures for better code sharing * rename some variables (e.g. to communicate their purpose a bit better) This patch doesn't change _what_ is being tested.
Differential Revision: https://reviews.llvm.org/D93544
show more ...
|
#
d6abd731 |
| 21-Dec-2020 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Make the names of files created in unit tests unique (nfc)
Using files with identical names leads to unexpected failures when tests are run in parallel. This is tricky to reproduce,
[flang][driver] Make the names of files created in unit tests unique (nfc)
Using files with identical names leads to unexpected failures when tests are run in parallel. This is tricky to reproduce, but has been happening on some buildbots since merging https://reviews.llvm.org/D92854. In that patch I added a unit test with a non-unique test file. This patch fixes that.
show more ...
|
Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2 |
|
#
db2195bc |
| 18-Dec-2020 |
Andrzej Warzynski <andrzej.warzynski@arm.com> |
[flang][driver] Rename unittest file (nfc)
This patch renames PrintPreprocessedTest.cpp as FrontendActionTest.cpp. The latter reflects the contents of the file more accurately.
|