Commit graph

213 commits

Author SHA1 Message Date
peter klausler
935f0a2470 [flang] automate analysis of expression parse tree types that are wrappers/unions
Original-commit: flang-compiler/f18@e8fbd6c1fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:19 -07:00
peter klausler
f9d4cef84e [flang] cleaning up TODOs
Original-commit: flang-compiler/f18@cfd67de3cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:18 -07:00
peter klausler
dc31b3d1ca [flang] LOGICAL operations
Original-commit: flang-compiler/f18@71a1de4c59
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:17 -07:00
peter klausler
003c8329ba [flang] add left(), right(), and comments
Original-commit: flang-compiler/f18@372fd06508
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:16 -07:00
peter klausler
63a26fc7dc [flang] mixed z+i, z+r expressions
Original-commit: flang-compiler/f18@5c5d11c1f7
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:12 -07:00
peter klausler
5f43f78b82 [flang] more operators
Original-commit: flang-compiler/f18@4925b4b944
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:11 -07:00
peter klausler
79408f956d [flang] restructure work in progress in semantics/expression.cc; checkpoint before finishing operators
Original-commit: flang-compiler/f18@5d991b0df3
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:10 -07:00
peter klausler
b357bfcb99 [flang] checkpoint
Original-commit: flang-compiler/f18@04697760f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:09 -07:00
peter klausler
70febd9285 [flang] cleanup
Original-commit: flang-compiler/f18@99c4bcb60c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:07 -07:00
peter klausler
b1d441749c [flang] checkpoint once g++ can build again
Original-commit: flang-compiler/f18@1c09641a6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:29:03 -07:00
peter klausler
a9446d3d40 [flang] work on numeric operations
Original-commit: flang-compiler/f18@e0ab91914c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:58 -07:00
peter klausler
e90480785d [flang] Replace FOR_EACH_... macro cruft with safer template metaprogramming.
Original-commit: flang-compiler/f18@bc3c4279b0
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:56 -07:00
peter klausler
b114c58118 [flang] Remove GenericExpr, move operator overloads to tools.h
Original-commit: flang-compiler/f18@23e7a6c27c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:56 -07:00
peter klausler
c0d3a67fac [flang] complex extraction of operator classes
Original-commit: flang-compiler/f18@0506bb7a0c
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:54 -07:00
peter klausler
e798ab7d91 [flang] checkpoint with clang workaround
Original-commit: flang-compiler/f18@c4a2aaf8b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:52 -07:00
peter klausler
98b9465527 [flang] expression analysis
Original-commit: flang-compiler/f18@dedfe182d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:49 -07:00
peter klausler
5566d70ef2 [flang] More cleaning
Original-commit: flang-compiler/f18@8227229f62
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:48 -07:00
peter klausler
d986a35a5c [flang] Extirpate expression-forward.h
Original-commit: flang-compiler/f18@288acd3993
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:47 -07:00
peter klausler
c75c9f0a54 [flang] Refactoring and renaming
Original-commit: flang-compiler/f18@29fc0bee8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:46 -07:00
peter klausler
94540975f3 [flang] clean up naming in expressions and types
Original-commit: flang-compiler/f18@ab17ef4d4b
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:46 -07:00
peter klausler
8b9efa289c [flang] checkpoint
Original-commit: flang-compiler/f18@3fae716c44
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:44 -07:00
peter klausler
2e68aff3fd [flang] Expression analysis checkpoint
Original-commit: flang-compiler/f18@f740cab641
Reviewed-on: https://github.com/flang-compiler/f18/pull/183
Tree-same-pre-rewrite: false
2018-09-12 16:28:43 -07:00
Tim Keith
db88ddf74e [flang] Improve error message for "type already declared"
Add reference to the statement where the type was first set.

Original-commit: flang-compiler/f18@911c90e99e
Reviewed-on: https://github.com/flang-compiler/f18/pull/179
2018-09-11 07:26:54 -07:00
Tim Keith
97355ddd2d [flang] The default kind of complex is the same as that of real.
Original-commit: flang-compiler/f18@16080c0674
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
2018-09-12 11:37:29 -07:00
Tim Keith
ae3b96456f [flang] Simplify representation of intrinsic types
Intrinsic types are now just a TypeCategory and a int kind. If no kind
is specified the default is used so that every type has an explicit
kind. This caused changes in the expected results of some of the tests.

Add support for "double precision" and "double complex".

Intrinsic types are now stored as values in DeclTypeSpec so none of the
KindedTypeHelper machinery is needed any more.

Eliminate DerivedTypeDef, DataComponentDef, ProcComponentDef,
TypeBoundProc. The components and bindings of a derived type are now
represented by the corresponding Scope.

Original-commit: flang-compiler/f18@4ad8ffb187
Reviewed-on: https://github.com/flang-compiler/f18/pull/182
Tree-same-pre-rewrite: false
2018-09-11 17:33:42 -07:00
Eric Schweitz
dba93d3fbe [flang] Fixes the Label vs. IntLiteralConstant issue flang-compiler/f18#180
Original-commit: flang-compiler/f18@40387158dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
Tree-same-pre-rewrite: false
2018-09-11 16:26:19 -07:00
Eric Schweitz
6e38e225a4 [flang] tweak Legality
Original-commit: flang-compiler/f18@19834c65d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
2018-09-11 14:01:25 -07:00
Eric Schweitz
412393babb [flang] clang-format doesn't
Original-commit: flang-compiler/f18@0114db6ced
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
e12f6121b9 [flang] Remove the strict F18 checking flag. Always check that program is
strictly conforming to F18, but demote errors to warnings when the
Fortran is legal under pre-F18 standards. If the Fortran is illegal
under F18 _and_ previous standards, then emit an error.

Original-commit: flang-compiler/f18@6d1f37683a
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
6265aed20e [flang] convert name to lowercase
Original-commit: flang-compiler/f18@f591d31ab4
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
b3a87d4e27 [flang] More renaming
Original-commit: flang-compiler/f18@9ef9ef4479
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
facd02405f [flang] Fix a couple other spots clang-format missed
Original-commit: flang-compiler/f18@1a4b12e1b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
51a48e542a [flang] clang-format didn't clean up some of the code. delete std::make_pair call.
Original-commit: flang-compiler/f18@4defccc50d
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
20cc4d5134 [flang] Simplify some of the if-return-else-return expansions while possibly
keeping things readable.

Original-commit: flang-compiler/f18@55b7e18763
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
8ad03ecf87 [flang] Per review:
Change initializer lists to use curlies.
Change uses of std::tuple to PODs & add ctors per compiler complaining.

Original-commit: flang-compiler/f18@42c5cdcaab
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
38ec0d0fce [flang] More review comment actions.
Original-commit: flang-compiler/f18@eb7ab3452d
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
603353d2ef [flang] Changes for the latest round of syntax change requests per the review.
Original-commit: flang-compiler/f18@0df221aeda
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
466e5df90d [flang] remove emacs line
Original-commit: flang-compiler/f18@64aa22d644
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
715a1ed493 [flang] Changes per the review comments. The majority of the changes are simply
to rename identifiers to meet the project (not LLVM) coding standard.
Includes a home brew of FileCheck for testing.

Original-commit: flang-compiler/f18@bb15490cc0
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
7bdf04b695 [flang] Use is_same<> templates
Original-commit: flang-compiler/f18@a47f6bacf0
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
69dc2e446f [flang] Merge up to new Messages interface
Original-commit: flang-compiler/f18@ca45fdd1cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
Eric Schweitz
df4575f6b9 [flang] Add label resolution design document, pass, and tests
Original-commit: flang-compiler/f18@e0d0df900c
Reviewed-on: https://github.com/flang-compiler/f18/pull/170
Tree-same-pre-rewrite: false
2018-09-11 14:01:25 -07:00
peter klausler
9a94a23482 [flang] Better error recovery and messages for PROCEDURE components
Original-commit: flang-compiler/f18@19813349aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/178
Tree-same-pre-rewrite: false
2018-09-10 14:20:35 -07:00
Tim Keith
7227cfe026 [flang] Miscellaneous name resolution
Handle BIND statement and PARAMETER statement. They are different from
other attribute-setting statements so some refactoring of
HandleAttributeStmt is required. And for PARAMETER, SetType needs to
report an error if the implicitly determined type is changed later. This
requires operator== on DeclTypeSpec.

Resolve names in allocate statements, pointer assignment statements,
substring expressions, and type parameter values.

Original-commit: flang-compiler/f18@79ad96b976
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
2018-09-10 12:20:42 -07:00
Tim Keith
7ebbe7dca4 [flang] Write private symbols to .mod files
We were trying to write only symbols that are part of the public API of
a module to the .mod file. The problem with that is that submodules need
access to the private symbols in their ancestor modules and submodules.

For now, just write out all of the symbols, private or otherwise.
We could be more precise by omitting some private symbols for modules
that don't have separate module procedures and so can't have submodules.

Also, the old implementation went into an infinite loop for recursive
derived types.

This makes CollectSymbols simpler, so have it do both the collecting and
sorting. Make it static so that the types don't have to be defined in
mod-file.h.

Original-commit: flang-compiler/f18@33a10d6238
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-10 11:39:03 -07:00
Tim Keith
78c62eaf02 [flang] Ensure use of ObjectEntityDetails for data objects
A symbol is created with EntityDetails if we don't know whether it is a
procedure or data object. At the end of the specification part, if we
don't know it's a procedure then it must be an object, so convert it
then. So after name resolution there should be no symbols with
EntityDetails.

Also, a couple of small fixes:
- need to visit sub-nodes of shape specs so that any names get resolved
- don't report an error for an array element mis-parsed as a call

Original-commit: flang-compiler/f18@0effecd225
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-07 09:57:14 -07:00
Tim Keith
f14e3030e8 [flang] Code cleanup
Rename stmtFuncsToConvert to stmtFuncsToConvert_.
Make member functions out-of-line.

Original-commit: flang-compiler/f18@3ada89d22f
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-07 09:31:02 -07:00
Tim Keith
6bf633b7bd [flang] Fix bug in rewriting function calls
Arrays are now represented with ObjectEntityDetails, not EntityDetails.
So that's what we have to look for when rewriting function calls to
array element references.

Original-commit: flang-compiler/f18@841b37d94b
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false
2018-09-07 09:31:02 -07:00
Tim Keith
a1fff9af07 [flang] Address review comments
Change IsModule to a member function of Scope.

Make multiple PRIVATE statements in a derived type be a non-fatal error.

Original-commit: flang-compiler/f18@dd42dcd15a
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
2018-09-07 09:06:27 -07:00
Tim Keith
b168cc0b83 [flang] Add procedure pointer components for derived types
Also eliminate `derivedTypeData_`. Information about derived types needed
during name resolution is in `derivedTypeInfo_` and the permanent record
is the symbol table.

Original-commit: flang-compiler/f18@789960bd95
Reviewed-on: https://github.com/flang-compiler/f18/pull/175
Tree-same-pre-rewrite: false
2018-09-06 12:06:32 -07:00