[llvm-branch-commits] [flang] 28a1b6e - Revert "[flang] Version information in flang/f18"

2020-08-18 Thread Richard Barton via llvm-branch-commits

Author: Richard Barton
Date: 2020-08-18T12:17:13+01:00
New Revision: 28a1b6ea4db9e405d563ad36ca4b3bb1916f92ed

URL: 
https://github.com/llvm/llvm-project/commit/28a1b6ea4db9e405d563ad36ca4b3bb1916f92ed
DIFF: 
https://github.com/llvm/llvm-project/commit/28a1b6ea4db9e405d563ad36ca4b3bb1916f92ed.diff

LOG: Revert "[flang] Version information in flang/f18"

This reverts commit 844f018114b52325b36e1042c8a8fc0ea82d9c17.

Added: 


Modified: 
flang/test/Driver/version_test.f90
flang/tools/f18/CMakeLists.txt
flang/tools/f18/f18.cpp

Removed: 
flang/test/Preprocessing/compiler_defined_macros.F90
flang/tools/f18/f18_version.h.in



diff  --git a/flang/test/Driver/version_test.f90 
b/flang/test/Driver/version_test.f90
index 7fe229e2be17..08ea35ba49ea 100644
--- a/flang/test/Driver/version_test.f90
+++ b/flang/test/Driver/version_test.f90
@@ -1,10 +1,7 @@
 ! Check that lit configuration works by checking the compiler version
 
+! RUN: %f18 -V 2>&1 | FileCheck  -check-prefix=VERSION %s
 ! VERSION-NOT:{{![[:space:]]}}
 ! VERSION:{{[[:space:]]}}
-! VERSION-SAME:f18 compiler (under development), version 
{{[1-9][0-9]*.[0-9]*.[0-9]*}}
+! VERSION-SAME:f18 compiler (under development)
 ! VERSION-EMPTY:
-
-! RUN: %f18 -V 2>&1 | FileCheck  -check-prefix=VERSION %s
-! RUN: %f18 -v 2>&1 | FileCheck  -check-prefix=VERSION %s
-! RUN: %f18 --version 2>&1 | FileCheck  -check-prefix=VERSION %s

diff  --git a/flang/test/Preprocessing/compiler_defined_macros.F90 
b/flang/test/Preprocessing/compiler_defined_macros.F90
deleted file mode 100644
index 80852cfb4472..
--- a/flang/test/Preprocessing/compiler_defined_macros.F90
+++ /dev/null
@@ -1,12 +0,0 @@
-! Check that the macros that give the verion number are set properly
-
-!CHECK: flang_major = {{[1-9][0-9]*$}}
-!CHECK: flang_minor = {{[0-9]+$}}
-!CHECK: flang_patchlevel = {{[0-9]+$}}
-!RUN: %f18 -E %s | FileCheck  --ignore-case %s
-
-  
-integer, parameter :: flang_major = __flang_major__
-integer, parameter :: flang_minor = __flang_minor__
-integer, parameter :: flang_patchlevel = __flang_patchlevel__
-

diff  --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 3dfce3437948..46c38fa43a2e 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -64,6 +64,5 @@ file(COPY ${CMAKE_BINARY_DIR}/tools/flang/bin/flang 
DESTINATION ${CMAKE_BINARY_D
 # The flang script to be installed needs a 
diff erent path to the headers.
 set(FLANG_INTRINSIC_MODULES_DIR ${CMAKE_INSTALL_PREFIX}/include/flang)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flang.sh.in 
${FLANG_BINARY_DIR}/bin/flang-install.sh @ONLY)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/f18_version.h.in 
${CMAKE_CURRENT_BINARY_DIR}/f18_version.h @ONLY)
 
 install(PROGRAMS ${FLANG_BINARY_DIR}/bin/flang-install.sh DESTINATION bin 
RENAME flang PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE)

diff  --git a/flang/tools/f18/f18.cpp b/flang/tools/f18/f18.cpp
index 23b104ee520c..03c0f7afe810 100644
--- a/flang/tools/f18/f18.cpp
+++ b/flang/tools/f18/f18.cpp
@@ -38,8 +38,6 @@
 #include 
 #include 
 
-#include "f18_version.h"
-
 static std::list argList(int argc, char *const argv[]) {
   std::list result;
   for (int j = 0; j < argc; ++j) {
@@ -392,13 +390,6 @@ void Link(std::vector &liblist, 
std::vector &objects,
   }
 }
 
-int printVersion() {
-  llvm::errs() << "\nf18 compiler (under development), version "
-   << __FLANG_MAJOR__ << "." << __FLANG_MINOR__ << "."
-   << __FLANG_PATCHLEVEL__ << "\n";
-  return exitStatus;
-}
-
 int main(int argc, char *const argv[]) {
 
   atexit(CleanUpAtExit);
@@ -420,11 +411,6 @@ int main(int argc, char *const argv[]) {
   options.predefinitions.emplace_back("__F18_MAJOR__", "1");
   options.predefinitions.emplace_back("__F18_MINOR__", "1");
   options.predefinitions.emplace_back("__F18_PATCHLEVEL__", "1");
-  options.predefinitions.emplace_back("__flang__", __FLANG__);
-  options.predefinitions.emplace_back("__flang_major__", __FLANG_MAJOR__);
-  options.predefinitions.emplace_back("__flang_minor__", __FLANG_MINOR__);
-  options.predefinitions.emplace_back(
-  "__flang_patchlevel__", __FLANG_PATCHLEVEL__);
 #if __x86_64__
   options.predefinitions.emplace_back("__x86_64__", "1");
 #endif
@@ -665,16 +651,13 @@ int main(int argc, char *const argv[]) {
   << "Unrecognised options are passed through to the external 
compiler\n"
   << "set by F18_FC (see defaults).\n";
   return exitStatus;
-} else if (arg == "-V" || arg == "--version") {
-  return printVersion();
+} else if (arg == "-V") {
+  llvm::errs() << "\nf18 compiler (under development)\n";
+  return exitStatus;
 } else {
   driver.F18_FCArgs.push_back(arg);
   if (arg == "-v") {
-if (args.size() > 1) {
-  driver.verbose = true;
-} else {
-  return printVersion();
-}
+  

[llvm-branch-commits] [flang] 9ad89a8 - [flang] Convert release notes to markdown

2020-09-10 Thread Richard Barton via llvm-branch-commits

Author: Richard Barton
Date: 2020-09-10T20:10:38+01:00
New Revision: 9ad89a8cc3c7de0f0b5a306932671a4c78644d03

URL: 
https://github.com/llvm/llvm-project/commit/9ad89a8cc3c7de0f0b5a306932671a4c78644d03
DIFF: 
https://github.com/llvm/llvm-project/commit/9ad89a8cc3c7de0f0b5a306932671a4c78644d03.diff

LOG: [flang] Convert release notes to markdown

Switch ReleaseNotes from .rst to .md to match the other docs.

At the same time, fix the version number for master.

Added: 
flang/docs/ReleaseNotes.md

Modified: 


Removed: 
flang/docs/ReleaseNotes.rst



diff  --git a/flang/docs/ReleaseNotes.md b/flang/docs/ReleaseNotes.md
new file mode 100644
index ..b891ab904a04
--- /dev/null
+++ b/flang/docs/ReleaseNotes.md
@@ -0,0 +1,87 @@
+# Flang 11.0.0 (In-Progress) Release Notes
+
+> **warning**
+>
+> These are in-progress notes for the upcoming LLVM 11.0.0 release.
+> Release notes for previous releases can be found on [the Download
+> Page](https://releases.llvm.org/download.html).
+
+## Introduction
+
+This document contains the release notes for the Flang Fortran frontend,
+part of the LLVM Compiler Infrastructure, release 11.0.0. Here we
+describe the status of Flang in some detail, including major
+improvements from the previous release and new feature work. For the
+general LLVM release notes, see [the LLVM
+documentation](https://llvm.org/docs/ReleaseNotes.html). All LLVM
+releases may be downloaded from the [LLVM releases web
+site](https://llvm.org/releases/).
+
+Note that if you are reading this file from a Git checkout, this
+document applies to the *next* release, not the current one. To see the
+release notes for a specific release, please see the [releases
+page](https://llvm.org/releases/).
+
+## Known Issues
+
+These are issues that couldn't be fixed before the release. See the bug
+reports for the latest status.
+
+ *   ...
+
+## Introducing Flang
+
+Flang is LLVM's Fortran front end and is new for the LLVM 11 release.
+
+Flang is still a work in progress for this release and is included for
+experimentation and feedback.
+
+Flang is able to parse a comprehensive subset of the Fortran language
+and check it for correctness. Flang is not yet able to generate LLVM IR
+for the source code and thus is unable to compile a running binary.
+
+Flang is able to unparse the input source code into a canonical form and
+emit it to allow testing. Flang can also invoke an external Fortran
+compiler on this canonical input.
+
+Flang's parser has comprehensive support for:
+ * Fortran 2018
+ * OpenMP 4.5
+ * OpenACC 3.0
+
+Interested users are invited to try to compile their Fortran codes with
+flang in and report any issues in parsing or semantic checking in
+[bugzilla](https://bugs.llvm.org/enter_bug.cgi?product=flang).
+
+### Major missing features
+
+ * Flang is not supported on Windows platforms.
+
+## Using Flang
+
+Usage: `flang hello.f90 -o hello.bin`
+
+By default, Flang will parse the Fortran file `hello.f90` then unparse it to a
+canonical Fortran source file. Flang will then invoke an external
+Fortran compiler to compile this source file and link it, placing the
+resulting executable in `hello.bin`.
+
+To specify the external Fortran compiler, set the `F18_FC` environment
+variable to the name of the compiler binary and ensure that it is on your
+`PATH`. The default value for `F18_FC` is `gfortran`.
+
+When invoked with no source input, Flang will wait for input on stdin.
+When invoked in this way, Flang performs the same actions as if
+called with `-fdebug-measure-parse-tree -funparse` and does not invoke
+`F18_FC`.
+
+For a full list of options that Flang supports, run `flang --help`.
+
+## Additional Information
+
+Flang's documentation is located in the `flang/docs/` directory in the
+LLVM monorepo.
+
+If you have any questions or comments about Flang, please feel free to
+contact us via the [mailing
+list](https://lists.llvm.org/mailman/listinfo/flang-dev).

diff  --git a/flang/docs/ReleaseNotes.rst b/flang/docs/ReleaseNotes.rst
deleted file mode 100644
index bbc7377412d6..
--- a/flang/docs/ReleaseNotes.rst
+++ /dev/null
@@ -1,96 +0,0 @@
-
-Flang 11.0.0 (In-Progress) Release Notes
-
-
-.. contents::
-   :local:
-   :depth: 2
-
-.. warning::
-
-   These are in-progress notes for the upcoming LLVM 11.0.0 release.
-   Release notes for previous releases can be found on
-   `the Download Page `_.
-
-Introduction
-
-
-This document contains the release notes for the Flang Fortran
-frontend, part of the LLVM Compiler Infrastructure, release 11.0.0. Here we
-describe the status of Flang in some detail, including major
-improvements from the previous release and new feature work. For the
-general LLVM release notes, see `the LLVM
-documentation 

[llvm-branch-commits] [flang] 01be54e - [flang] Add new documentation main page

2020-09-11 Thread Richard Barton via llvm-branch-commits

Author: Richard Barton
Date: 2020-09-11T15:21:07+01:00
New Revision: 01be54e257d9f09c6bbc7fe98f8f7449b30b37da

URL: 
https://github.com/llvm/llvm-project/commit/01be54e257d9f09c6bbc7fe98f8f7449b30b37da
DIFF: 
https://github.com/llvm/llvm-project/commit/01be54e257d9f09c6bbc7fe98f8f7449b30b37da.diff

LOG: [flang] Add new documentation main page

Add a new index page to be the Flang documentation mainpage instead of
Overview.md, which jumps straight into the compiler Design. The index file
needs to be in .rst format to use the toctree directive to create table of
contents.

Also use the sphinx_markdown_tables extension to generate html tables form
markdown.

A number of additional style changes to the existing docs were needed to make
this work well:
 * Convert all headings to the # style, which works better with toctree's
   titlesonly option. Ensure that there is only one top-level heading per
   document.
 * Add a title to documents that don't have one for rendering on the index.
 * Convert the grammar docs from .txt to .md. for better rendering
 * Fixed broken link to a section in another document - sphinx does not seem to
   support anchor links in markdown files.

Depends on D87226

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D87242

Added: 
flang/docs/OpenMP-4.5-grammar.md
flang/docs/f2018-grammar.md
flang/docs/index.md

Modified: 
flang/docs/ArrayComposition.md
flang/docs/BijectiveInternalNameUniquing.md
flang/docs/C++17.md
flang/docs/C++style.md
flang/docs/Calls.md
flang/docs/Character.md
flang/docs/ControlFlowGraph.md
flang/docs/Directives.md
flang/docs/Extensions.md
flang/docs/FortranForCProgrammers.md
flang/docs/FortranIR.md
flang/docs/IORuntimeInternals.md
flang/docs/ImplementingASemanticCheck.md
flang/docs/Intrinsics.md
flang/docs/LabelResolution.md
flang/docs/ModFiles.md
flang/docs/OpenMP-semantics.md
flang/docs/OptionComparison.md
flang/docs/Overview.md
flang/docs/ParserCombinators.md
flang/docs/Parsing.md
flang/docs/Preprocessing.md
flang/docs/PullRequestChecklist.md
flang/docs/RuntimeDescriptor.md
flang/docs/Semantics.md
flang/docs/conf.py

Removed: 
flang/docs/OpenMP-4.5-grammar.txt
flang/docs/f2018-grammar.txt



diff  --git a/flang/docs/ArrayComposition.md b/flang/docs/ArrayComposition.md
index 0f30af39f9e4..9e61abe5670f 100644
--- a/flang/docs/ArrayComposition.md
+++ b/flang/docs/ArrayComposition.md
@@ -6,6 +6,13 @@
   
 -->
 
+# Array Composition
+
+```eval_rst
+.. contents::
+   :local:
+```
+
 This note attempts to describe the motivation for and design of an
 implementation of Fortran 90 (and later) array expression evaluation that
 minimizes the use of dynamically allocated temporary storage for
@@ -34,8 +41,8 @@ Other Fortran intrinsic functions are technically 
transformational (e.g.,
 `COMMAND_ARGUMENT_COUNT`) but not of interest for this note.
 The generic `REDUCE` is also not considered here.
 
-Arrays as functions
-===
+## Arrays as functions
+
 A whole array can be viewed as a function that maps its indices to the values
 of its elements.
 Specifically, it is a map from a tuple of integers to its element type.
@@ -45,8 +52,8 @@ and the shape of the array delimits the domain of the map.
 `REAL :: A(N,M)` can be seen as a function mapping ordered pairs of integers
 `(J,K)` with `1<=J<=N` and `1<=J<=M` to real values.
 
-Array expressions as functions
-==
+## Array expressions as functions
+
 The same perspective can be taken of an array expression comprising
 intrinsic operators and elemental functions.
 Fortran doesn't allow one to apply subscripts directly to an expression,
@@ -83,8 +90,8 @@ side variable as an operand of the right-hand side 
expression, and any
 function calls on the right-hand side are elemental or scalar-valued,
 we can avoid the use of a temporary.
 
-Transformational intrinsic functions as function composition
-
+## Transformational intrinsic functions as function composition
+
 Many of the transformational intrinsic functions listed above
 can, when their array arguments are viewed as functions over their
 index tuples, be seen as compositions of those functions with
@@ -127,8 +134,8 @@ More completely:
 * `SPREAD(A,DIM=d,NCOPIES=n)` for compile-time `d` simply
   applies `A` to a reduced index tuple.
 
-Determination of rank and shape
-===
+## Determination of rank and shape
+
 An important part of evaluating array expressions without the use of
 temporary storage is determining the shape of the result prior to,
 or without, evaluating the elements of the result.
@@ -173,8 +180,8 @@ In cases where the analyzed shape is known at compile time, 
we should
 be able to have the opportunity to av