[mlir rebase] Add MLIR config and react to MLIR name changes
Similar to flang-compiler/f18#1085. Now use the MLIR package to set up paths for include files and libraries. Three MLIR names changed:
* VectorOpsDialect to VectorDialect
* AffineOpsDialect to AffineDialect
* createVectorizePass to createSuperVectorizePass
Update README.md to explain how to link with MLIR. Update the example gcc to version 8.3.
Update drone.io config to define -DMLIR_DIR
Co-authored-by: Jean Perier <jperier@nvidia.com>
Original-commit: flang-compiler/f18@116f64315f
Reviewed-on: https://github.com/flang-compiler/f18/pull/1090
Adds FIR library that implements an MLIR dialect to which Fortran
parse-tree will be lowered to.
FIR is defined and documented inside FIROps.td added in this commit.
It is possible to generate a more readable description FIRLangRef.md
from FIROps.td following the related instructions added to the README.md
by this commit.
This patch adds FIR definition and implementation that allow parsing,
printing, and verifying FIR. FIR transformations and lowering to Standard
and LLVM dialects are not part of this patch. The FIR verifiers are verifying
the basic properties of FIR operations in order to provide a sufficient
frame for lowering. Verifiers for more advanced FIR properties can be added
as needed.
Coarrays are not covered by FIR defined in this patch.
This patch also adds tco tool that is meant to process FIR input files and
drives transformations on it. The tco tool is used for testing.
In this patch, it is only used to demonstrate parsing/verifying/
and dumping FIR with round-trip tests.
Note:
This commit does not reflect an actual work log, it is a feature-based split of the
changes done in the FIR experimental branch. The related work log can be found in the
commits between:
742edde572
and
2ff5524212
Changes on top of these original commits were made during this patch review.
Original-commit: flang-compiler/f18@30b428a51e
Reviewed-on: https://github.com/flang-compiler/f18/pull/1035
The Pre-FIR Tree structure is a transient data structure that
is meant to be built from the parse tree just before lowering to
FIR and that will be deleted just afterwards. It is not meant to perfrom
optimization analysis and transformations. It only provides temporary
information, such as label target information or parse tree parent nodes,
that is meant to be used to lower the parse tree structure into
FIR operations.
A PFTBuilder class builds the Pre-Fir Tree from the parse-tree.
A pretty printer is available to visualize this data structure.
- Lit tests are added to:
1. that the PFT tree structure is as expected
2. that the PFT captures all intented nodes
- Cmake changes: Prevent warnings inisde LLVM headers when compiling flang
The issue is that some LLVM headers define functions where the usage of
the parameters depend on environment ifdef. See for instance Size in:
5f940220bf/llvm/include/llvm/Support/Compiler.h (L574)
Because flang is build with -Werror and -Wunused-parameter is default in
clang, this may breaks build in some environments (like with clang9 on macos).
A solution would be to add -Wno-unused-parameter to flang CmakLists.txt,
but it is wished to keep this warning on flang sources for quality purposes.
Fixing LLVM headers is not an easy task and `[[maybe_unused]]` is C++17 and
cannot be used yet in LLVM headers.
Hence, this fix simply silence warnings coming from LLVM headers by telling
CMake they are to be considered as if they were system headers.
- drone.io changes: remove llvm 6.0 from clang config in drone.io and link
flang with libstdc++ instead of libc++
llvm-dev resolved to llvm-6.0 in clang builds on drone.io. llvm 6.0 too old.
LLVM packages are linked with libstdc++ standard library whereas libc++ was
used for flang. This caused link time failure when building clang. Change
frone.io to build flang with libc++.
Note:
This commit does not reflect an actual work log, it is a feature based split of the
changes done in the FIR experimental branch. The related work log can be found in the
commits between:
864898cbe509d032abfe1172ec367dbd3dd92bc1
and
137c23da9c64cf90584cf81fd646053a69e91f63
Other changes come from https://github.com/flang-compiler/f18/pull/959 review.
Original-commit: flang-compiler/f18@edb0943bca
Reviewed-on: https://github.com/flang-compiler/f18/pull/959