Commit graph

2311 commits

Author SHA1 Message Date
peter klausler
79e8749f25 [flang] Address comments, fix a bug
Original-commit: flang-compiler/f18@e095bbb23f
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:45 -07:00
peter klausler
b4f34801c6 [flang] Improve comments, clean up a couple of things
Original-commit: flang-compiler/f18@8d94d643b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:43 -07:00
peter klausler
1502542fe7 [flang] Fix copyright date on new file.
Original-commit: flang-compiler/f18@60b1be7ce2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:43 -07:00
peter klausler
474c43a075 [flang] Correct header guards
Original-commit: flang-compiler/f18@77688d0392
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:40 -07:00
peter klausler
bd3debe841 [flang] Reenable thorough test
Original-commit: flang-compiler/f18@431254483e
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:38 -07:00
peter klausler
28d55be08b [flang] Better unsigned division by constants
Original-commit: flang-compiler/f18@1b35c24a8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:37 -07:00
peter klausler
b5408d26ed [flang] Clean up some static_casts
Original-commit: flang-compiler/f18@a5f81388a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:34 -07:00
peter klausler
3f15d46f63 [flang] Simplify guard bits (only use 3)
Original-commit: flang-compiler/f18@b710268c1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:33 -07:00
peter klausler
64a0a58bed [flang] Work around slow clang-7
Original-commit: flang-compiler/f18@ed634d72e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:32 -07:00
peter klausler
b235c63caf [flang] faster Parse
Original-commit: flang-compiler/f18@ca97439c68
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:31 -07:00
peter klausler
c4696eaf8e [flang] Get clean build with gcc
Original-commit: flang-compiler/f18@e6b5ed152d
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:30 -07:00
peter klausler
94d8b3f25b [flang] Simplify decimal->binary
Original-commit: flang-compiler/f18@01aefbbd7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:29 -07:00
peter klausler
d08c9c9d1d [flang] Make thorough test thorough again
Original-commit: flang-compiler/f18@c24b10e434
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:27 -07:00
peter klausler
95165a3921 [flang] Replace usage of original decimal conversion code with calls to new library
Original-commit: flang-compiler/f18@7a164451f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:26 -07:00
peter klausler
099838a34d [flang] Debug test
Original-commit: flang-compiler/f18@bf2c22bcf4
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:25 -07:00
peter klausler
77b3c6d53a [flang] More testing, added thorough 32-bit sweep test
Original-commit: flang-compiler/f18@f81b92f91c
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:25 -07:00
peter klausler
3863551b31 [flang] Testing & debugging
Original-commit: flang-compiler/f18@f7f933e7f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:24 -07:00
peter klausler
afda616c31 [flang] Begin adding tests
Original-commit: flang-compiler/f18@8776d8b663
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:20 -07:00
peter klausler
9cdb101a4d [flang] clean up a todo
Original-commit: flang-compiler/f18@1107bd1f02
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:18 -07:00
peter klausler
93f3ae8aeb [flang] Enforce digit limits
Original-commit: flang-compiler/f18@33600e127d
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:16 -07:00
peter klausler
b53e09c44c [flang] Add rounding modes
Original-commit: flang-compiler/f18@9caa1a29a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:13 -07:00
peter klausler
9e26defed3 [flang] Code snapshot
Original-commit: flang-compiler/f18@46923344ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:12 -07:00
peter klausler
f2cb0a8015 [flang] Move leading zero bit count into lib/common
Original-commit: flang-compiler/f18@1ed184febe
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:11 -07:00
Tim Keith
d1dcd76d14 [flang] Merge pull request flang-compiler/f18#675 from flang-compiler/tsk-modfiles2
Fix bugs in .mod file generation

Original-commit: flang-compiler/f18@5de0847a64
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
2019-08-23 11:28:33 -07:00
Tim Keith
a03a0432f3 [flang] Add conversions from EnumSet<Attr> to Attrs
This allows operations from EnumSet (e.g. `operator&`) to work as expected.

Original-commit: flang-compiler/f18@c8b8b742c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
2019-08-23 08:28:20 -07:00
Tim Keith
5e65aaa921 [flang] Fix .mod file bug with IMPORT of USEd name
If a symbol (derived type, for example) was use-associated into a scope
and then imported into a nested interface block, we were not including
the correct IMPORT statement in the .mod file.

This fixes refines the test for when the IMPORT is needed.

Fixes flang-compiler/f18#657.

Original-commit: flang-compiler/f18@8383de47ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Tim Keith
191a5e34b0 [flang] Fix bug in .mod file for some subprogram attributes
Some attributes for subprograms can be in the subprogram prefix but
others cannot. For the latter, emit a separate attribute statement
to specify them. We were already doing that for PRIVATE but not for
OPTIONAL. Those may be the only two attributes this can apply to.

Fixes flang-compiler/f18#659.

Original-commit: flang-compiler/f18@ae67e08780
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Tim Keith
abd56ee7fd [flang] Fix writing defined operators to .mod files
When defined operators were written to .mod files in USE statement
they did not come out correctly. They have to be emitted with
`PutGenericName()` so that `operator` is included.

Original-commit: flang-compiler/f18@d40e65a2f9
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Jinxin (Brian) Yang
20eaba0392 [flang] [OpenMP] miscellaneous parse tree updates (flang-compiler/f18#673)
1. Big chunk: update comments in parse-tree.h and openmp-grammar.h
   with Spec chapter/section info, simple explanation, or productions.

2. Update `To`, `Link`, and `From` clauses with `OmpObjectList` to allow
   `/Common Block/`. Spec does not mention whether `Common Block name`
   should be accepted or not, so we should assume that these clauses
   accept normal `list-item`, which is `Variable`, `Array Section`, or
   `Common Block name`.

Original-commit: flang-compiler/f18@140315cb62
Reviewed-on: https://github.com/flang-compiler/f18/pull/673
2019-08-23 09:45:03 -07:00
jeanPerier
4308351c37 [flang] Merge pull request flang-compiler/f18#634 from flang-compiler/jpr-fix-604
Fix a crash with IMPORT in BLOCK (issue 604)

Original-commit: flang-compiler/f18@c0ab1d1ace
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
2019-08-23 02:19:36 -07:00
Jean Perier
511cd36a58 [flang] Address comment: remove useless const
Original-commit: flang-compiler/f18@60983f5021
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
2019-08-22 01:12:20 -07:00
Jean Perier
52e72abb67 [flang] Change Scope::name() to Scope::GetName()
Address comments. Not all scopes are related to
a name. This change makes this more visible to compiler
programers by changing `scope:name()` into `Scope::GetName()`
that returns an optional `SourceName` instead of always
returning a `SourceName` and dying when it cannot.

Original-commit: flang-compiler/f18@0addb79919
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 06:29:11 -07:00
Jean Perier
281d41cc10 [flang] Use value semantic for SourceName
Change all SourceName* to std::optional<SourceName> because
SourceName is small enough (16 bytes) to be passed and stored
by value which avoid having to worry about life-time, storage and
value constance issues that comes with pointers.

Original-commit: flang-compiler/f18@73fc08d7bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 05:33:03 -07:00
Jean Perier
5cc20f6ae8 [flang] Fix test copyright year.
Original-commit: flang-compiler/f18@25819aaf7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 02:56:25 -07:00
Jean Perier
f2453c9f15 [flang] Fix a crash with IMPORT in BLOCK (issue 604)
Only call scope.name() if the scope has a symbol (Block, Global,
Forall and ImpliedDo kind of scopes do not have a symbol).

Original-commit: flang-compiler/f18@81c6b67dd2
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 02:56:24 -07:00
Jinxin (Brian) Yang
5330ebbc4a [flang] [OpenMP] Canonicalization framework (flang-compiler/f18#599)
* [OpenMP] Canonicalization framework

This is mainly designed for loop association work but can be used for others,
and `CanonicalizeOmp` must be after `CanonicalizeDo`.

At the `Block` level, recognize legal sequence of `OpenMPLoopConstruct`,
`DoConstruct`, and `OmpEndLoopDirective`. Move available `DoConstruct`
and optional `OmpEndLoopDirective` into `OpenMPLoopConstruct`. Throw error
messages if:
 1. `DoConstruct` is not following `OpenMPLoopConstruct`
 2. `OmpEndLoopDirective` is not following associated do-loop

Once this pass this done, Semantics will not proceed if error exists.

* Update on reviews

1. extract matching and move part into its own function (once `DoConstruct`
   is moved, see whether `OpenMPEndLoopDirective` is available)

2. Use a template function to access construct from ExecutionPartConstruct.

3. Move this code into namespace semantics

Original-commit: flang-compiler/f18@52979f1e93
Reviewed-on: https://github.com/flang-compiler/f18/pull/599
2019-08-22 10:34:15 -07:00
jeanPerier
f8f98c2cde [flang] Merge pull request flang-compiler/f18#672 from flang-compiler/jpr-fix-574
Handle AssocEntityDetails in mis-parsed function reference

Original-commit: flang-compiler/f18@0006272bbd
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
2019-08-22 05:49:15 -07:00
Jean Perier
1bb0e9e362 [flang] Add comments and tests for issue 574 fix
Original-commit: flang-compiler/f18@89337cefc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
2019-08-21 02:42:34 -07:00
Jean Perier
ccb0b48805 [flang] Handle AssocEntityDetails in mis-parsed function reference
Fix issue flang-compiler/f18#574.
Array references can be mistaken for function references during
parsing. This is handled and fixed by semantics. however, if the
symbol in the misparsed array reference was construct associated,
then semantics was not handling the case correctly because
semantics was only expecting `ObjectEntityDetails`.
It was not possible to change the related `GetUltimate` into
`GetAssociationRoot` because associated symbols are not always
associated to another symbol (variable) but may be assoicated to
an expression. Hence, this change allow `AssocEntityDetails` to
be also accepted when dealing with array references misparsed as
function references.

Original-commit: flang-compiler/f18@b6a8b5f42b
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
Tree-same-pre-rewrite: false
2019-08-20 06:15:52 -07:00
Eric Schweitz
be2ab4b3a2 [flang] Merge pull request flang-compiler/f18#668 from schweitzpgi/master
Add mlir-tablegen for FIR ops

Original-commit: flang-compiler/f18@f6eec72eea
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
2019-08-21 11:21:01 -07:00
Eric Schweitz
7f2ce553e4 [flang] Add FIR dialect header
Original-commit: flang-compiler/f18@3c902e04d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
2019-08-16 19:01:49 -07:00
Eric Schweitz
9325f9974a [flang] Add mlir-tablegen for FIR ops
Original-commit: flang-compiler/f18@aae4b525da
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
Tree-same-pre-rewrite: false
2019-08-16 16:14:22 -07:00
psteinfeld
d06c8f8ee4 [flang] Merge pull request flang-compiler/f18#663 from flang-compiler/ps-c1129
Checks for constraint C1129

Original-commit: flang-compiler/f18@f724efb683
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
2019-08-20 21:08:04 -07:00
Peter Steinfeld
d440b2e166 [flang] Responses to comments on the pull request:
- I removed the redundant test s3() from dosemantics90.f90
 - I changed the error messages to state "LOCAL locality-spec" rather than just
   "locality-spec"
 - I changed the names of a couple of variables/parameters in check-do.cc to
   make the code more understandable.

Original-commit: flang-compiler/f18@bcc6291e83
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
2019-08-20 15:18:37 -07:00
Peter Steinfeld
6b8a1e8248 [flang] Changes to implement constraint C1129
"C1129 A variable that is referenced by the scalar-mask-expr of a concurrent-header or by any concurrent-limit or concurrent-step in that concurrent-header shall not appear in a LOCAL locality-spec in the same DO CONCURRENT statement."

In the process of implementing these checks, I found and fixed some other problems.  I also cleaned up some of the code in check-do.cc.  I ran into two notable difficulties in implementing these checks.  First, the symbols associated with the names in a locality spec get created when the locality specs are process during name resolution.  Thus, they're different from the symbols associated with names that appear in the control expressions.  At Tim's suggestion, I dealt with this by looking up the symbols from the names in the locality spec starting with the closest enclosing scope containing the DO construct.  Second, the symbols can be hidden behind host- use- and construct-associations.

Original-commit: flang-compiler/f18@055788c2f0
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false
2019-08-20 15:18:37 -07:00
Peter Steinfeld
d8c4f96f14 [flang] Clean-up of check-do.cc
I got rid of duplicate functions that test for a procedure being PURE, renamed
the type SymbolContainer to SymbolSet, and moved some functions into the class
where they're referenced.

Original-commit: flang-compiler/f18@e48bfdf573
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false
2019-08-20 15:18:37 -07:00
Jinxin (Brian) Yang
ca5fee5375 [flang] [OpenMP] miscellaneous parse tree fix (flang-compiler/f18#669)
Fix `aligned(argument-list[ : alignment])` for `declare simd`

(original implementation will throw parser error if `: alignment` is present.


Original-commit: flang-compiler/f18@f3f50f9ad3
Reviewed-on: https://github.com/flang-compiler/f18/pull/669
2019-08-20 10:30:29 -07:00
Jinxin (Brian) Yang
39be4ad473 [flang] [OpenMP] parse tree fix for Declare Target (flang-compiler/f18#670)
The original implementation will throw parsing error for multiple
clauses on `declare target` directive, for example:
```
!$omp declare target to(Q) link(R)
```

Based on the OpenMP Spec, we only need two types for the specifier:

```
!$omp declare target (extended-list)
```
or
```
!$omp declare target [clause[ [,] clause] ... ]
```

This fix makes `declare target` accepts either the `list` or `clauses`,
which is more general and better for error messages.

Adjusted existing test for checking the parse tree changes. More tests
will be added during Semantics.

Original-commit: flang-compiler/f18@60f47fc1a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/670
2019-08-20 10:23:56 -07:00
Tim Keith
fdf85d5dbe [flang] Merge pull request flang-compiler/f18#655 from flang-compiler/tsk-issue649
Special handling for VOLATILE and ASYNCHRONOUS

Original-commit: flang-compiler/f18@75a57c59d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/655
2019-08-20 07:38:04 -07:00
Tim Keith
ff768d92dd [flang] Special handling for VOLATILE and ASYNCHRONOUS
The VOLATILE and ASYNCHRONOUS attributes are special in two ways:
- they can be applied to use-associated variables
- if they are applied to a host-associated variable in a block, that
  variable has the attribute only within the scope of the block

The latter is implemented by making a new `HostAssocDetails` symbol
within the block where the attribute can be set without affecting the
variable in the outer scope. This is similar to how the SHARED locality
spec is implemented.

Fixes flang-compiler/f18#649.

Original-commit: flang-compiler/f18@471aba4513
Reviewed-on: https://github.com/flang-compiler/f18/pull/655
2019-08-13 13:50:24 -07:00