Commit graph

1009 commits

Author SHA1 Message Date
Jean Perier
63c88cdbc0 [flang] Fixed CFI_DESC_T macro. Started unit test for C interop
Original-commit: flang-compiler/f18@f29b80c758
Reviewed-on: https://github.com/flang-compiler/f18/pull/222
Tree-same-pre-rewrite: false
2018-11-02 09:42:35 -07:00
Tim Keith
5e4aaaeb43 [flang] Merge pull request flang-compiler/f18#223 from flang-compiler/tsk5
Resolve expressions in symbols

Original-commit: flang-compiler/f18@6f253b5514
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
2018-11-07 12:43:56 -08:00
Tim Keith
66d2705025 [flang] Address review comments
Change `const Symbol *` to `const Symbol &`.
Simplify expression for `Assumed()` and `Deferred()` in `ParamValue`.

Original-commit: flang-compiler/f18@b3e76706ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
2018-11-07 12:41:52 -08:00
Tim Keith
9095548553 [flang] Resolve expressions in symbols
Add `LazyExpr` class to represent expressions in the symbol table.
Initially they contain a pointer to an expression in the parse tree.
After name resolution is complete and symbols are filled in in the parse
tree, `LazyExpr`s are resolved to `evaluate::Expr<evaluate::SomeType>`.
This is done by `ResolveSymbolExprs()`.

Change `Bound` and `ParamValue` to save their value as a `LazyExpr`.
Change `ObjectEntityDetails` and `TypeParamDetails` to save the initial
value as a `LazyExpr`.

Eliminate `IntExpr` and `IntConst` classes, which were just place-holders.

Add `Clone()` to `ShapeSpec`, `Bound`, `LazyExpr`. Normally they should
be moved but in `ObjectEntityDetails::set_shape()` we need to make copies.

Save type parameter values in `derivedTypeSpec_`. `typeParamValue_` is
not needed.

Write out initial values, type parameter values, and bounds to .mod files.

Evaluate parameter values in expressions.

Make some errors non-fatal so that tests can continue to pass.

Original-commit: flang-compiler/f18@b90cadfc53
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
Tree-same-pre-rewrite: false
2018-11-06 17:18:06 -08:00
Tim Keith
1466eb250d [flang] Remove include of symbol.h from variable.h
This include will lead to circularities when semantics/type.h needs
include evaluate/expression.h. There will probably be a different
long-term solution.

Original-commit: flang-compiler/f18@c7fa815036
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
Tree-same-pre-rewrite: false
2018-11-06 17:12:02 -08:00
Tim Keith
c59de6ca1d [flang] Use forward declarations to reduce includes
Original-commit: flang-compiler/f18@384af49342
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
Tree-same-pre-rewrite: false
2018-11-05 15:03:46 -08:00
Tim Keith
b917390549 [flang] Move Details rather than copying
We don't need to copy the various Details classes. We will be adding
expressions to some of them (e.g. for bounds or initial values) and they
should generally be moved as well.

In check-do-concurrent.cc, put pointers to Symbols in the symbol
collections rather than copies.

Original-commit: flang-compiler/f18@cdedfc9b3e
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
Tree-same-pre-rewrite: false
2018-11-05 14:36:11 -08:00
Peter Klausler
7a9a18227e [flang] Merge pull request flang-compiler/f18#221 from flang-compiler/pmk0
Document various pointer-like abstractions

Original-commit: flang-compiler/f18@11b472741d
Reviewed-on: https://github.com/flang-compiler/f18/pull/221
2018-11-01 15:06:22 -07:00
peter klausler
ddb3d99ec0 [flang] address review comment
Original-commit: flang-compiler/f18@b5da6b4492
Reviewed-on: https://github.com/flang-compiler/f18/pull/221
2018-11-01 15:06:01 -07:00
peter klausler
bd204fcc32 [flang] document pointer variations
Original-commit: flang-compiler/f18@4c718f5664
Reviewed-on: https://github.com/flang-compiler/f18/pull/221
Tree-same-pre-rewrite: false
2018-11-01 13:43:24 -07:00
peter klausler
a5511a2b44 [flang] document pointer variations
Original-commit: flang-compiler/f18@70c55eb1eb
Reviewed-on: https://github.com/flang-compiler/f18/pull/221
Tree-same-pre-rewrite: false
2018-11-01 13:18:28 -07:00
Peter Klausler
69d46eced4 [flang] Merge pull request flang-compiler/f18#219 from flang-compiler/pmk0
A refactoring of folding

Original-commit: flang-compiler/f18@a056aaabbb
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
2018-10-29 09:56:25 -07:00
peter klausler
011e6abd9f [flang] readability improvement from Tim
Original-commit: flang-compiler/f18@14179ead7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
2018-10-29 09:26:33 -07:00
peter klausler
0a56867df9 [flang] Back out needless macro change that led to clang-format grief
Original-commit: flang-compiler/f18@5a6e55df11
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 16:31:20 -07:00
peter klausler
8832f8b144 [flang] clean up comments, put out for review
Original-commit: flang-compiler/f18@26a3221fc4
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:55:28 -07:00
peter klausler
87b74269d5 [flang] prepare for merge
Original-commit: flang-compiler/f18@5d2490b1c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:21:04 -07:00
peter klausler
abac228b82 [flang] Complete refactor of Fold() - checkpoint
Original-commit: flang-compiler/f18@5061171268
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:21:01 -07:00
peter klausler
3f6ae3550f [flang] merge
Original-commit: flang-compiler/f18@d0cd9544f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:13 -07:00
peter klausler
a99e9c99f3 [flang] complete new Fold
Original-commit: flang-compiler/f18@4d1726778f
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:12 -07:00
peter klausler
60c16541c2 [flang] dodge gcc 7.2.0 build hiccup
Original-commit: flang-compiler/f18@4a9e862d74
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:10 -07:00
peter klausler
f50047f45c [flang] merge with master
Original-commit: flang-compiler/f18@53f15da06a
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:10 -07:00
peter klausler
d6ea6af7c4 [flang] new refactored Fold
Original-commit: flang-compiler/f18@061868fd85
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:09 -07:00
peter klausler
43a0a63441 [flang] start refactoring of Constant and Fold
Original-commit: flang-compiler/f18@53f7174c3d
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:07 -07:00
peter klausler
d804c9d6bb [flang] Refactor some lib/evaluate headers for sanity
Original-commit: flang-compiler/f18@9530378c39
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:17:52 -07:00
peter klausler
84ea49d062 [flang] rearrange arguments into dummy argument order
Original-commit: flang-compiler/f18@3bab0f55de
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:16:46 -07:00
peter klausler
ef9dd9d1fe [flang] refactor a bit, and rearrange actual arguments into dummy order on intrinsic calls
Original-commit: flang-compiler/f18@1f50ace68b
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:16:41 -07:00
peter klausler
fdd3a2adca [flang] Use Attrs for intrinsic results rather than flags.
Original-commit: flang-compiler/f18@14c9199718
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:15:54 -07:00
Tim Keith
f1d20a35ec [flang] Merge pull request flang-compiler/f18#218 from flang-compiler/tsk2
More name resolution for submodules

Original-commit: flang-compiler/f18@f574667aaa
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
2018-10-26 11:58:13 -07:00
Tim Keith
b78109e22e [flang] Address review comments
Original-commit: flang-compiler/f18@c3597a1984
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
2018-10-26 11:57:08 -07:00
Tim Keith
507121f63f [flang] Process SeparateModuleSubprogram during name resolution
When a SeparateModuleSubprogram is encountered, check that there is a
corresponding declaration in the current module/submodule or an ancestor.
When it's the current program unit, special handling is required to
avoid trying to declare it again.

Module subprograms with the `MODULE` prefix are handled similarly.
The `hasModulePrefix` flag is passed in to `BeginSubprogram` to
distinguish this case.

Extract common part of `Post(SubroutineStmt)` and `Post(FunctionStmt)` into
`PostSubprogramStmt`. Add code there to ensure that separate module
procedures do not have `EXTERNAL` set. This requires a fix to `ModFileWriter`
to correctly decide when a subprogram is declared in an interface block.

Extract `WalkSubprogramPart` into a separate function. It walks the
internal or module subprograms collecting their names. It is needed to
handle separate module subprograms.

Original-commit: flang-compiler/f18@339b65f251
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:34:50 -07:00
Tim Keith
ed23707231 [flang] Reformat and add comment
Original-commit: flang-compiler/f18@524f224adc
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:16:00 -07:00
Tim Keith
6778aa5c4f [flang] Fix failure to resolve submodule name.
If we have `SUBMODULE(m:s1) s2` and `s1` is already in memory (i.e. does
not need to be read from the `m-s1.mod` file), we still need to record
the fact that the name is a reference to that module symbol.

Original-commit: flang-compiler/f18@4bb42ed6a4
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:16:00 -07:00
Tim Keith
ac0c599920 [flang] Fix bug with popping scopes.
Processing a SUBMODULE can cause any number of scopes to be pushed on
the scope stack. We don't know how many to pop at the end, so add
`ClearScopes()` to reset the scope stack to its original state.

Original-commit: flang-compiler/f18@0be4cebd66
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:16:00 -07:00
jeanPerier
4687189913 [flang] Merge pull request flang-compiler/f18#217 from flang-compiler/namespace-comment-removal
Format Style Change: Removed namespace comments after closing brace

Original-commit: flang-compiler/f18@dcca71aae2
Reviewed-on: https://github.com/flang-compiler/f18/pull/217
2018-10-26 11:18:57 +02:00
Jean Perier
f7e7cb349b [flang] Changed .clang-format so that it will not add a comment after the closing brace of each namespace. Removed all such previous comments from all .cc and .h files
Original-commit: flang-compiler/f18@aa7f55e15f
Reviewed-on: https://github.com/flang-compiler/f18/pull/217
2018-10-25 05:55:23 -07:00
Tim Keith
9077dc289b [flang] Merge pull request flang-compiler/f18#216 from flang-compiler/tsk4
Fix bug in rewriting function reference

Original-commit: flang-compiler/f18@22f25eadc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/216
2018-10-25 11:44:37 -07:00
Tim Keith
e064f4f4b9 [flang] Fix bug in rewriting function reference
`a(i)` is parsed as a function reference and needs to be converted to an
array element reference when `a` is an object entity. That determination
was wrong if the symbol for `a` was a symbol representing host-association
or use-association. In that case we need to get to the original symbol
by calling `GetUltimate()` on the symbol.

This was causing symbol09.f90 to get a compilation error because an
array element reference looked like a call to a non-pure function, which
is prohibited inside a DO CONCURRENT.

Original-commit: flang-compiler/f18@221e6c52c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/216
2018-10-24 13:39:17 -07:00
Eric Schweitz
c873638052 [flang] Merge pull request flang-compiler/f18#196 from flang-compiler/eas6
DO CONCURRENT semantic constraints checking

Original-commit: flang-compiler/f18@304c6f6548
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
2018-10-24 12:22:42 -07:00
Eric Schweitz
fd93b9f3ae [flang] Fix conflicts
Fix more rotten bits
Fix the tests to reflect merges

Original-commit: flang-compiler/f18@b9a1a8b809
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
2018-10-24 12:22:42 -07:00
Eric Schweitz
da521a2284 [flang] add openmp simd test
Original-commit: flang-compiler/f18@c31bb0d144
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
f0c8e2ab38 [flang] minor changes
Move functions out of FindDoConcurrentLoops
tweak comments

Original-commit: flang-compiler/f18@713c7e8f9e
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
e644e6e8c8 [flang] add C1120, C1122 and placehokders for C1006, C1121, and C1123
add a new test for C1120
Fix new test's CHECKs
More contraints hacking

Original-commit: flang-compiler/f18@197e5fd750
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
76fc3ab928 [flang] Add OpenMP annotated loops example as a test
Original-commit: flang-compiler/f18@d0177b8cc6
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
e75f2551c1 [flang] enable the IEEE_GET_FLAG test
Original-commit: flang-compiler/f18@3f95b388a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
ad014e3ce4 [flang] More review changes
Original-commit: flang-compiler/f18@48f34e66c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
04d5058723 [flang] Global replace identifier names.
Original-commit: flang-compiler/f18@93303cd50d
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
1f0b29916d [flang] Incorperate review comments
Original-commit: flang-compiler/f18@33ff57e320
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
30c7c99d54 [flang] Add more constraint checking for DO CONCURRENT.
Add some more tests.

Original-commit: flang-compiler/f18@e65f755fe1
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
bbdfd7d4d0 [flang] add another resolve-label test for misplaced end do statement.
Original-commit: flang-compiler/f18@17fa8c1ebf
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
4c02758a80 [flang] Cleanup some cruft and tweaks per review comments.
Added a negative test, to check that semantics are not applied bogusly
to loops that are not DO CONCURRENT.

Original-commit: flang-compiler/f18@d8de45e994
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00