Commit graph

1377 commits

Author SHA1 Message Date
Eric Schweitz
bdb94d41ca [flang] Merge pull request flang-compiler/f18#323 from flang-compiler/eas0
Fix build breakage

Original-commit: flang-compiler/f18@46e416acc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/323
2019-03-11 09:37:31 -07:00
Eric Schweitz
cf18b7a6bd [flang] Fix build breakage
Original-commit: flang-compiler/f18@72d003f89d
Reviewed-on: https://github.com/flang-compiler/f18/pull/323
2019-03-11 09:16:01 -07:00
Eric Schweitz
70d55c0ce2 [flang] Merge pull request flang-compiler/f18#319 from flang-compiler/eas0
FIR update

Original-commit: flang-compiler/f18@3f6f710889
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
2019-03-11 09:01:14 -07:00
Eric Schweitz
4fd1e5d795 [flang] Address review comments; merge with latest breaking changes on master
Original-commit: flang-compiler/f18@ffde96d486
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
2019-03-11 08:59:33 -07:00
Eric Schweitz
829e8247ed [flang] Run old clang-format over FIR directory
Original-commit: flang-compiler/f18@0616ac43ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:57:41 -07:00
Eric Schweitz
686d4daf6c [flang] Repairs for new interfaces
Original-commit: flang-compiler/f18@1a080dfe6a
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:57:41 -07:00
Eric Schweitz
d6964c42f2 [flang] FIR statements: various reworking of the code to decompose some
operations, get rid of unneeded nodes, restructure DO loops, etc.

Original-commit: flang-compiler/f18@0e0d67fbda
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:57:41 -07:00
Eric Schweitz
2ad50e0712 [flang] react to more review comments
Original-commit: flang-compiler/f18@b685d8a588
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:56:36 -07:00
Eric Schweitz
ddedf6688b [flang] cleanup merge
Original-commit: flang-compiler/f18@ea00eab799
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:56:36 -07:00
Eric Schweitz
1ee88d3c81 [flang] Fixes for building with clang++ and other misc. from review
Original-commit: flang-compiler/f18@c3cdc32786
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:56:36 -07:00
Eric Schweitz
a981cd5b9e [flang] Move over build recipes and rename the library
Original-commit: flang-compiler/f18@51476aa178
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:56:36 -07:00
Eric Schweitz
35cf9e4c40 [flang] Fortran Intermediate Representation: initial draft based on "CFG" note.
Original-commit: flang-compiler/f18@b7a7595394
Reviewed-on: https://github.com/flang-compiler/f18/pull/319
Tree-same-pre-rewrite: false
2019-03-11 08:56:12 -07:00
Peter Klausler
88f0d5e443 [flang] Merge pull request flang-compiler/f18#322 from flang-compiler/pmk-struct-constr-disambig
Fix two ambiguous parsing cases by patching parse tree in expression semantics

Original-commit: flang-compiler/f18@d4807f1364
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
2019-03-09 10:59:20 -08:00
peter klausler
c57fda817e [flang] Address review comment
Original-commit: flang-compiler/f18@8a9a41487e
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
2019-03-09 10:25:08 -08:00
peter klausler
f3abed639d [flang] Fix misparsings of substrings in the parse tree, not in expressions.
Original-commit: flang-compiler/f18@53d0e26d92
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
Tree-same-pre-rewrite: false
2019-03-09 10:25:07 -08:00
peter klausler
e3b632337d [flang] add structconst04.f90 test and fixes to pass it
Original-commit: flang-compiler/f18@d857c843f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
Tree-same-pre-rewrite: false
2019-03-09 10:25:07 -08:00
peter klausler
64ea462e3a [flang] Resolve misparse of structure constructor as function reference.
Original-commit: flang-compiler/f18@5b6b2540f6
Reviewed-on: https://github.com/flang-compiler/f18/pull/322
Tree-same-pre-rewrite: false
2019-03-09 10:25:06 -08:00
Tim Keith
bc409369c2 [flang] Merge pull request flang-compiler/f18#321 from flang-compiler/tsk3
Remove build dependency on clang

Original-commit: flang-compiler/f18@737998bb50
Reviewed-on: https://github.com/flang-compiler/f18/pull/321
2019-03-09 08:55:41 -08: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
4105558efe [flang] Merge pull request flang-compiler/f18#320 from flang-compiler/pmk-expr-rearrangement
Rearrange/simplify expr analysis code

Original-commit: flang-compiler/f18@4eaccde516
Reviewed-on: https://github.com/flang-compiler/f18/pull/320
2019-03-08 12:56:32 -08:00
peter klausler
972b3af6d4 [flang] Rearrange/simplify expr analysis code
Original-commit: flang-compiler/f18@aa9f3a7cca
Reviewed-on: https://github.com/flang-compiler/f18/pull/320
2019-03-07 14:46:31 -08:00
Tim Keith
b3d74e3e14 [flang] Merge pull request flang-compiler/f18#317 from flang-compiler/tsk10
Simplify Semantics::Perform

Original-commit: flang-compiler/f18@c435fe65a4
Reviewed-on: https://github.com/flang-compiler/f18/pull/317
2019-03-07 10:52:40 -08:00
Tim Keith
251e0196e4 [flang] Simplify Semantics::Perform
`Semantics::Perform` is mostly a series of calls followed by a check
for fatal errors. There is more error checking logic than real code.

To make it clearer, change each of the phases it calls to return true
on success so that `Perform` can just call them one after the other.

Original-commit: flang-compiler/f18@a218cac788
Reviewed-on: https://github.com/flang-compiler/f18/pull/317
2019-03-06 17:07:25 -08:00
Peter Klausler
c1970da239 [flang] Merge pull request flang-compiler/f18#316 from flang-compiler/pmk-expr-walk
Add Expression traversal framework, use it to reimplement IsConstantE…

Original-commit: flang-compiler/f18@90cd33adcb
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
2019-03-06 16:56:07 -08:00
peter klausler
18e436afc4 [flang] add descender.h
Original-commit: flang-compiler/f18@cfc3082b7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
2019-03-06 16:15:55 -08:00
peter klausler
0de89a5c7d [flang] add rewriting as well as const visitation
Original-commit: flang-compiler/f18@1224eaee85
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:54 -08:00
peter klausler
1a38f0091b [flang] More rearrangement
Original-commit: flang-compiler/f18@7a675d9df6
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:53 -08:00
peter klausler
b7b187e976 [flang] Hide implementation better
Original-commit: flang-compiler/f18@2118b46314
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:53 -08:00
peter klausler
642c78b680 [flang] back out one change
Original-commit: flang-compiler/f18@27fb43b6ed
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:52 -08:00
peter klausler
53ae00a9c4 [flang] Address review comments
Original-commit: flang-compiler/f18@3ed6199fed
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:52 -08:00
peter klausler
d9a3442c30 [flang] Improve detection of default Handle() callback
Original-commit: flang-compiler/f18@c09c4c9e00
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:51 -08:00
peter klausler
803d9eabba [flang] some tweaks
Original-commit: flang-compiler/f18@07d196386e
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:50 -08:00
peter klausler
dbed3cebdc [flang] Add Expression traversal framework, use it to reimplement IsConstantExpr()
Original-commit: flang-compiler/f18@f5d3915935
Reviewed-on: https://github.com/flang-compiler/f18/pull/316
Tree-same-pre-rewrite: false
2019-03-06 16:15:49 -08:00
Tim Keith
87abe61c54 [flang] Merge pull request flang-compiler/f18#315 from flang-compiler/tsk10
Create framework for checking statement semantics

Original-commit: flang-compiler/f18@0fcdb68061
Reviewed-on: https://github.com/flang-compiler/f18/pull/315
2019-03-06 16:11:19 -08:00
Tim Keith
f85ac283c5 [flang] Move ExprChecker into separate pass
DoConcurrentChecker depends on expressions being fully resolved so it
can't be in the same pass as ExprChecker. The same will probably
apply to AssignmentChecker when its finished.

Checks that don't depend on expressions can go in the first pass
with ExprChecker.

Original-commit: flang-compiler/f18@c0785ec06f
Reviewed-on: https://github.com/flang-compiler/f18/pull/315
2019-03-06 14:15:13 -08:00
Tim Keith
d19308787c [flang] Add test for AssignmentChecker
Add a test to verify that AssignmentChecker is actually running.

Original-commit: flang-compiler/f18@2c91604e9b
Reviewed-on: https://github.com/flang-compiler/f18/pull/315
Tree-same-pre-rewrite: false
2019-03-06 14:12:20 -08:00
Tim Keith
813e48dc21 [flang] Create framework for checking statement semantics
Add `SemanticsVisitor` as the visitor class to perform statement
semantics checks. Its template parameters are "checker" classes
that perform the checks. They have `Enter` and `Leave` functions
that are called for the corresponding parse tree nodes (`Enter`
before the children, `Leave` after). Unlike `Pre` and `Post` in
visitors they cannot prevent the parse tree walker from visiting
child nodes.

Existing checks have been incorporated into this framework:
- `ExprChecker` replaces `AnalyzeExpressions()`
- `AssignmentChecker` replaces `AnalyzeAssignments()`
- `DoConcurrentChecker` replaces `CheckDoConcurrentConstraints()`

Adding a new checker requires:
- defining the checker class:
  - with BaseChecker as virtual base class
  - constructible from `SemanticsContext`
  - with Enter/Leave functions for nodes of interest
- add the checker class to the template parameters of `StatementSemantics`

Because these checkers and also `ResolveNamesVisitor` require tracking
the current statement source location, that has been moved into
`SemanticsContext`. `ResolveNamesVisitor` and `SemanticsVisitor`
update the location when `Statement` nodes are encountered, making it
available for error messages.

`AnalyzeKindSelector()` now has access to the current statement through
the context and so no longer needs to have it passed in.

Test `assign01.f90` was added to verify that `AssignmentChecker` is
actually doing something.

Original-commit: flang-compiler/f18@3a222c3673
Reviewed-on: https://github.com/flang-compiler/f18/pull/315
Tree-same-pre-rewrite: false
2019-03-05 16:52:50 -08:00
Peter Klausler
18329e2524 [flang] Merge pull request flang-compiler/f18#311 from flang-compiler/pmk-struct-checks
More structure constructor semantics checking

Original-commit: flang-compiler/f18@5561c9012c
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
2019-03-05 14:40:50 -08:00
peter klausler
0987d31f3e [flang] Tweak API per review
Original-commit: flang-compiler/f18@c0ab787cd1
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
2019-03-05 13:11:57 -08:00
peter klausler
6a0f9474ff [flang] Use value()/has_value() on Indirection class templates instead of operator*/operator->
Original-commit: flang-compiler/f18@a97f377ae6
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-05 12:28:08 -08:00
peter klausler
97038db10e [flang] Dodge bogus G++ 8.1.0 build warning
Original-commit: flang-compiler/f18@582c6d1eca
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 17:02:48 -08:00
peter klausler
da2ebb6063 [flang] Improve error messages
Original-commit: flang-compiler/f18@4046134512
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:25 -08:00
peter klausler
6acfa11fda [flang] Add lib/semantics/tools.{h,cc}
Original-commit: flang-compiler/f18@c9823da207
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:25 -08:00
peter klausler
8a57433273 [flang] C1594 constraint checking on pointer components in struct constructors
Original-commit: flang-compiler/f18@386cd8a9b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:24 -08:00
peter klausler
ec8e8b8277 [flang] Length conversions in array constructors, and fix their formatting
Original-commit: flang-compiler/f18@88cdb49f48
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:24 -08:00
peter klausler
69352908e0 [flang] Character length conversion on structure constructor component assignments
Original-commit: flang-compiler/f18@051c1dd923
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:24 -08:00
peter klausler
3edc423bf8 [flang] Add SetLength operator to make character length changes explicit
Original-commit: flang-compiler/f18@f2d751d8a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:23 -08:00
peter klausler
431b84880a [flang] snapshot of work in progress
Original-commit: flang-compiler/f18@56e83d4dd6
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:23 -08:00
peter klausler
402cc8c4e9 [flang] Represent NULL()
Original-commit: flang-compiler/f18@2c3368fb5f
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:23 -08:00
peter klausler
857da8cfe9 [flang] Type checking on values in structure components
Original-commit: flang-compiler/f18@bea98aeb96
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:22 -08:00