Commit graph

60 commits

Author SHA1 Message Date
Luke Ireland da9d002b18 [flang] Added CMakeLists changes, moved config and made test scripts compatible.
All Fortran tests are now run in lit, except Preprocessing tests flang-compiler/f18#1052
Preprocessing tests are a separate kind of test, so will be sorted out
later.

Original-commit: flang-compiler/f18@3f99d35f3d
Reviewed-on: https://github.com/flang-compiler/f18/pull/1027
2020-03-13 13:54:24 +00:00
Luke Ireland ee5fa1f233 [flang] Create a separate directory for unittests
Some of the regression tests are C programs that act as test harnesses
for the compiler internals as opposed to being Fortran inputs to test
the compiler in action. The former style of tests are analog to LLVM's
unittests and will not use the lit framework.

Change-Id: I0ff10e23f66ff843e8fff4c35cfb6559b9dab762

Original-commit: flang-compiler/f18@2bfddbe8f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/1027
Tree-same-pre-rewrite: false
2020-03-13 11:58:11 +00:00
jeanPerier 57f536a448 [flang] Add Fortran IR (FIR) MLIR dialect implementation (flang-compiler/f18#1035)
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
2020-03-11 21:47:22 -07:00
David Truby d545a132bc [flang] Link against zlib when LLVM does.
Original-commit: flang-compiler/f18@2260abe4c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/1043
2020-03-02 14:19:10 +00:00
Jean Perier 3364086795 [flang] Add Pre-FIR Tree structure to help lowering the parse-tree
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
2020-02-17 02:38:49 -08:00
CarolineConcatto 0d9dd49ed4 [flang] Regression tests configuration for f18 repository (flang-compiler/f18#861)
The configuration for the tests are in lit.* files.
The lit tests rely on the presence of llvm-lit,FileCheck, not and  count.
When building LLVM add:
-DLLVM_INSTALL_UTILS=On at the cmake command.
LLVM_LIT is found by setting LLVM_EXTERNAL_LIT in f18 CMakeLists.txt.

This patch:
  * Uses LLVM_EXTERNAL_LIT
  * Adds regression tests configurations
  * Adds a proof of concept regression test

The regression test needs to have the Utils build in LLVM.
This is done by adding:
  -DLLVM_INSTALL_UTILS=On
to the LLVM build cmake.

Signed-off-by: Caroline Concatto <caroline.concatto@arm.com>

Original-commit: flang-compiler/f18@a58c6067a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/861
2020-01-14 08:20:49 -08:00
Gary Klimowicz cea1040d51 [flang] Minor format change to LLVM license lines
Replace comment lines containing all dashes with the
proper ===-----....----=== markers.

Original-commit: flang-compiler/f18@a8936b0d41
Reviewed-on: https://github.com/flang-compiler/f18/pull/922
2020-01-10 12:12:03 -08:00
Gary Klimowicz 9e7548ab31 [flang] Flang relicensing changes for LLVM Apache 2.0 license
This changes the license information in many of the flang source files.
- Renamed LICENSE to LICENSE.txt.
- NVIDIA Copyright lines have been removed.
- Initial lines for files follow the LLVM coding convention (file name on the first line; Emacs mode information on the first line).
- License references have been replaced with the abridged LLVM text.
- License information was removed from the test files.
- No file header was placed on test files (these weren't in most LLVM test files).
- License information was added to documentation files where it was missing.

We did not add brief file summaries to the initial line.

See http://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
for a description of the new license.

See http://llvm.org/docs/CodingStandards.html#file-headers
for a description of the new LLVM standard file header.

Original-commit: flang-compiler/f18@add6cde724
Reviewed-on: https://github.com/flang-compiler/f18/pull/887
2019-12-23 10:26:16 -08:00
arjunsuresh1987 562b067439 [flang] Fix file path in cmake (flang-compiler/f18#844)
Original-commit: flang-compiler/f18@4771f8cb78
Reviewed-on: https://github.com/flang-compiler/f18/pull/844
2019-12-10 14:07:56 -08:00
peter klausler 637b933202 [flang] Enable more warnings, clean them up
Original-commit: flang-compiler/f18@c6b3420e5f
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
Tree-same-pre-rewrite: false
2019-10-02 12:40:52 -07:00
peter klausler d8c9b50fd6 [flang] Prep for review
Original-commit: flang-compiler/f18@8be02a41c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:35 -07:00
peter klausler fa3410d5fb [flang] Clean out some dead code, improve naming & comments
Original-commit: flang-compiler/f18@3495555565
Reviewed-on: https://github.com/flang-compiler/f18/pull/715
Tree-same-pre-rewrite: false
2019-09-09 09:26:36 -07:00
peter klausler 7749d43f3f [flang] Another pass with clean builds
Original-commit: flang-compiler/f18@e05dc1f444
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
2019-08-16 09:41:08 -07:00
peter klausler 10688e0903 [flang] Enable more warnings, deal with fallout
Original-commit: flang-compiler/f18@65c5b485af
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
2019-08-16 09:41:07 -07:00
peter klausler 73632f5c36 [flang] Enable some new warnings, clean up some of their consequences
Original-commit: flang-compiler/f18@b82d1e9ac9
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
2019-08-16 09:41:06 -07:00
peter klausler b3c7a79e2d [flang] -fno-exceptions
Original-commit: flang-compiler/f18@81d09c2053
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
Tree-same-pre-rewrite: false
2019-06-18 14:11:55 -07:00
Steve Scalpone 057fb5c2d0 [flang] Remove extra spaces.
Original-commit: flang-compiler/f18@777bf033b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/497
2019-06-12 21:01:26 -07:00
Steve Scalpone 43b6209ed9 [flang] Our coding conventions prohibit rtti; enforce with the -fno-rtti compilation flag.
Original-commit: flang-compiler/f18@d2817cc9c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/497
Tree-same-pre-rewrite: false
2019-06-12 17:01:41 -07:00
Steve Scalpone 1de9ecd251 [flang] Add CMake rules to install static and shared libraries in
the default install directory or in the directory specified
with CMAKE_INSTALL_PREFIX.  Fixes flang-compiler/f18#359.

Original-commit: flang-compiler/f18@35ce1628e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/364
2019-03-28 09:55:56 -07:00
peter klausler ad057a42fa [flang] Remove OwningPointer, use unique_ptr better instead.
Original-commit: flang-compiler/f18@89aff868aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/346
Tree-same-pre-rewrite: false
2019-03-20 11:38:45 -07:00
Tim Keith 9a6823bf4e [flang] Change default for LINK_WITH_FIR to ON.
Original-commit: flang-compiler/f18@b13f994463
Reviewed-on: https://github.com/flang-compiler/f18/pull/331
2019-03-14 09:08:27 -07:00
Tim Keith 1c9f8d408e [flang] Add cmake option to link with FIR and LLVM
The cmake option -DLINK_WITH_FIR=ON causes the f18 driver to be linked
against FIR and LLVM. When it is set to OFF (the default), the call into
FIR is #ifdef'd out.

The source in lib/FIR is always built; this option only affects linking.

Original-commit: flang-compiler/f18@69569edd4c
Reviewed-on: https://github.com/flang-compiler/f18/pull/329
2019-03-13 12:41:15 -07:00
Steve Scalpone 8fedd37b38 [flang] To use LLVM's libc++ instead of GCC's libstdc++, define
BUILD_WITH_CLANG_LIBRARIES on the cmake command line to
be the path to a clang installation with bin, lib, etc.
For this to work, BUILD_WITH_CLANG must be defined too.

Original-commit: flang-compiler/f18@a36d5fee42
Reviewed-on: https://github.com/flang-compiler/f18/pull/326
2019-03-11 10:49:46 -07:00
Tim Keith f8995fcefa [flang] Remove build dependency on clang
For now all we need to depend on is LLVM.
Use llvm_map_components_to_libnames to find libraries to link against.

Original-commit: flang-compiler/f18@dff1402c2a
Reviewed-on: https://github.com/flang-compiler/f18/pull/321
2019-03-08 15:16:58 -08:00
peter klausler 7f4fb7f89f [flang] update copyright date
Original-commit: flang-compiler/f18@c9dbc96042
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
2019-01-23 16:31:17 -08:00
peter klausler 85ea49eaba [flang] tweak CMakeLists.txt options
Original-commit: flang-compiler/f18@64ba0c0d6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:21 -08:00
peter klausler db5b3fbd89 [flang] Enable building f18 as shared libraries
Original-commit: flang-compiler/f18@4544d75af1
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:19 -08:00
peter klausler b23701f7d0 [flang] Rearrange some facilities into a new lib/common.
Original-commit: flang-compiler/f18@279af1e817
Reviewed-on: https://github.com/flang-compiler/f18/pull/106
2018-06-18 11:05:17 -07:00
peter klausler 57f4186ca2 [flang] Address review comments
Original-commit: flang-compiler/f18@d96917c701
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false
2018-06-14 13:53:09 -07:00
peter klausler ed71134af7 [flang] LOGICAL
Original-commit: flang-compiler/f18@6ec49f6edc
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false
2018-06-14 13:52:59 -07:00
peter klausler eb9ad7ef07 [flang] begin testing reals
Original-commit: flang-compiler/f18@9d261b594b
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false
2018-06-14 13:52:44 -07:00
peter klausler d0c120b371 [flang] Rename fixed-point to integer.
Original-commit: flang-compiler/f18@3fe9c505a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false
2018-06-14 13:52:31 -07:00
peter klausler 0dc145c255 [flang] Add pop count and parity code and tests.
Original-commit: flang-compiler/f18@a77f283183
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false
2018-06-14 13:52:27 -07:00
peter klausler 66107803fd [flang] Testing framework, debugging of fixed-point code.
Original-commit: flang-compiler/f18@a8fb2d75a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false
2018-06-14 13:52:18 -07:00
peter klausler 5bc907602c [flang] unit testing for LZBC
Original-commit: flang-compiler/f18@c8541fb8fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false
2018-06-14 13:52:16 -07:00
peter klausler 6261c0935c [flang] Document and initiate development of run time descriptors.
Original-commit: flang-compiler/f18@79edea528f
Reviewed-on: https://github.com/flang-compiler/f18/pull/92
Tree-same-pre-rewrite: false
2018-05-16 10:22:33 -07:00
peter klausler 3689fe7015 [flang] fix building with clang after merge
Original-commit: flang-compiler/f18@7b53bf2a16
Reviewed-on: https://github.com/flang-compiler/f18/pull/81
2018-05-04 10:19:50 -07:00
Stephane Chauveau 63141a0739 [flang] Manual backport of sch_llvm branch
Original-commit: flang-compiler/f18@17ee2d8e3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/78
Tree-same-pre-rewrite: false
2018-05-03 14:54:53 +02:00
Tim Keith 18cee3e8e6 [flang] Add copyright notices.
For source files (C++, Fortran, CMake) add copyright and license.
For documentation files add just copyright.

Original-commit: flang-compiler/f18@38381aed83
Reviewed-on: https://github.com/flang-compiler/f18/pull/74
2018-05-01 12:50:34 -07:00
peter klausler 681b59f282 [flang] Clean out the PGI stuff from CMakeLists.txt.
Original-commit: flang-compiler/f18@806db179ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
2018-04-27 15:03:28 -07:00
peter klausler 9702fcaf97 [flang] More Clang work.
Original-commit: flang-compiler/f18@7ff98ad778
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-27 12:37:47 -07:00
peter klausler 3fd2c17cf2 [flang] Use libc++ with clang.
Original-commit: flang-compiler/f18@d81b8d87f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 17:03:54 -07:00
peter klausler dd57a6e695 [flang] Refine CMakeLists.txt tweaks.
Original-commit: flang-compiler/f18@b40c68f9ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 16:16:01 -07:00
peter klausler ba4ee64c9d [flang] Package clang build settings.
Original-commit: flang-compiler/f18@775b42598d
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-26 16:03:01 -07:00
peter klausler 016fa9cf17 [flang] Attempt to build f18 with clang.
Original-commit: flang-compiler/f18@86fec97e41
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
2018-04-25 14:16:14 -07:00
Stephane Chauveau 8f6f23fc54 [flang] Add simple recursive CMake directory structure
Original-commit: flang-compiler/f18@a021b2ca76
Reviewed-on: https://github.com/flang-compiler/f18/pull/13
Tree-same-pre-rewrite: false
2018-02-19 14:28:12 +01:00
peter klausler 6595462268 [flang] Complete merge of provenance feature.
Original-commit: flang-compiler/f18@646f68be61
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler 67d916f8ba [flang] More precise source locations on error messages. Anticipate module file scanning.
Original-commit: flang-compiler/f18@f4faadd389
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler 783d5626fb [flang] Minor refactoring: extract TokenSequence into its own module.
Original-commit: flang-compiler/f18@1b17b4a069
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00
peter klausler 09865ffe7b [flang] Replace Position with Provenance everywhere.
Original-commit: flang-compiler/f18@8c2da3f8cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/9
Tree-same-pre-rewrite: false
2018-02-15 15:58:44 -08:00