Commit graph

974 commits

Author SHA1 Message Date
peter klausler
adc597b032 [flang] checkpoint work on descriptors
Original-commit: flang-compiler/f18@5e68ebea25
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:58 -07:00
peter klausler
ab9d0987a2 [flang] character folding
Original-commit: flang-compiler/f18@5adc208bf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:58 -07:00
peter klausler
fd6312ea05 [flang] complex and character comparisons
Original-commit: flang-compiler/f18@77ed88d24f
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:57 -07:00
peter klausler
439ddb334f [flang] Use std::nullopt in place of empty braces in return statements.
Original-commit: flang-compiler/f18@90e556301c
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:57 -07:00
peter klausler
b861018e3a [flang] COMPLEX folding
Original-commit: flang-compiler/f18@6f1ef45b2f
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:56 -07:00
peter klausler
bd146ed3e8 [flang] fold real**int
Original-commit: flang-compiler/f18@2dc2c2a6a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:56 -07:00
Peter Klausler
b9631a5d74 [flang] Merge pull request flang-compiler/f18#163 from flang-compiler/pmk1
Restore buildability with clang

Original-commit: flang-compiler/f18@65c88ddf0f
Reviewed-on: https://github.com/flang-compiler/f18/pull/163
2018-08-03 16:23:23 -07:00
peter klausler
fd3a82772f [flang] Update README to reflect buildability with GCC 8.2.0.
Original-commit: flang-compiler/f18@f64a9f5b82
Reviewed-on: https://github.com/flang-compiler/f18/pull/163
2018-08-03 16:11:29 -07:00
peter klausler
ca5c265569 [flang] Add virtual IntExpr::~IntExpr to silence Clang warning about non-virtual dtor in a class with virtual functions.
Original-commit: flang-compiler/f18@b024ba50e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/163
Tree-same-pre-rewrite: false
2018-08-03 16:07:58 -07:00
Peter Klausler
3e4cf24ed4 [flang] Merge pull request flang-compiler/f18#161 from flang-compiler/pmk1
issue#159 - better error messages in face of garbled source that resembles Hollerith

Original-commit: flang-compiler/f18@5aedd0d72c
Reviewed-on: https://github.com/flang-compiler/f18/pull/161
2018-08-03 15:29:13 -07:00
peter klausler
837b6960a5 [flang] Make prescanner tokenization message re: Hollerith truncation a warning, so parser get a shot at it. Merge messages from failed parsing alternatives more informatively.
Original-commit: flang-compiler/f18@16ed01d8f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/161
2018-08-03 14:16:16 -07:00
Tim Keith
e6528c15d5 [flang] Merge pull request flang-compiler/f18#160 from flang-compiler/tsk9
Add support for submodules

Original-commit: flang-compiler/f18@79f3632fc2
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
2018-08-03 11:33:14 -07:00
Tim Keith
ee51223da7 [flang] Changes based on review comments
Original-commit: flang-compiler/f18@fc4c0c39d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
2018-08-03 11:32:21 -07:00
Tim Keith
e90d137108 [flang] Make module files read-only.
Original-commit: flang-compiler/f18@c7752ab5fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
Tree-same-pre-rewrite: false
2018-08-02 16:38:36 -07:00
Tim Keith
96b187efdf [flang] Add support for submodules
Symbols for submodules have `ModuleDetails` with `isSubmodule` set.
Scopes for submodules have `Module` kind and have a parent scope that
is also `Module` kind.

Scopes for modules now contain a mapping of submodule name to scope
so that we can find them without having to search the scope tree or
re-read their `.mod` file.

The module file for submodule `s` with ancestor module `m` is named `m-s.mod`.
The tree structure of scopes means module file writing is now recursive.
Similarly, reading the module file for a submodule may require reading
the module files of its parent and ancestor. `ResolveNames` now requires
the parent scope to be passed in -- it is not always the global scope.

`test_modfiles.sh` now handles an argument that is a filename glob so
that the test can involve multiple files. This allows `modfile09` to
test reading of `.mod` files for modules and submodules.

Original-commit: flang-compiler/f18@2e4424dbc8
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
Tree-same-pre-rewrite: false
2018-08-02 16:21:27 -07:00
Tim Keith
4a20cc8478 [flang] Refactor to remove move semantics for Details
The classes in the Details union don't own resources so it makes things
simpler to copy them instead of moving. Same with ProcInterface.

Original-commit: flang-compiler/f18@d9ee19cbc4
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
Tree-same-pre-rewrite: false
2018-08-02 15:51:07 -07:00
Peter Klausler
4d3195f80c [flang] Merge pull request flang-compiler/f18#156 from flang-compiler/pmk1
Better program unit END statement error recovery.

Original-commit: flang-compiler/f18@902054b883
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
2018-07-31 12:35:42 -07:00
peter klausler
81b92ae6da [flang] Clean up end-of-statement error recovery. And fix issue#157.
Original-commit: flang-compiler/f18@23d8368571
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
2018-07-31 12:35:06 -07:00
peter klausler
e1b584468c [flang] Even better program unit END statement error recovery.
Original-commit: flang-compiler/f18@31f456ebc5
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
Tree-same-pre-rewrite: false
2018-07-30 16:33:55 -07:00
peter klausler
6135c20380 [flang] better program unit END statement error recovery
Original-commit: flang-compiler/f18@62799c88ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/156
Tree-same-pre-rewrite: false
2018-07-30 15:31:06 -07:00
Peter Klausler
e9a123623a [flang] Merge pull request flang-compiler/f18#155 from flang-compiler/pmk1
issue#153

Original-commit: flang-compiler/f18@bcac43a2c1
Reviewed-on: https://github.com/flang-compiler/f18/pull/155
2018-07-30 15:12:22 -07:00
peter klausler
7473cd711a [flang] issue#153
Original-commit: flang-compiler/f18@64272abddd
Reviewed-on: https://github.com/flang-compiler/f18/pull/155
2018-07-30 13:56:44 -07:00
Peter Klausler
7e05019220 [flang] Merge pull request flang-compiler/f18#154 from flang-compiler/pmk2
issue#152 and a little clean-up

Original-commit: flang-compiler/f18@220c6eb2c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/154
2018-07-30 13:55:19 -07:00
peter klausler
5369b346c3 [flang] issue#152 and a little clean-up
Original-commit: flang-compiler/f18@54d74dc1e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/154
2018-07-30 12:56:58 -07:00
Peter Klausler
8cbd3ef76a [flang] Merge pull request flang-compiler/f18#151 from flang-compiler/pmk1
Tweaks to source provenance and messaging in support of module files

Original-commit: flang-compiler/f18@21bb12c9d6
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
2018-07-30 11:38:54 -07:00
peter klausler
56cc22fdfe [flang] Use std::nullopt rather than {}.
Original-commit: flang-compiler/f18@9a740acf83
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
2018-07-30 11:08:22 -07:00
peter klausler
d90437bd91 [flang] address review comments
Original-commit: flang-compiler/f18@a18aba21fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 17:06:55 -07:00
peter klausler
851a5a00f9 [flang] add isModuleFile flag to parser::Options, use it
Original-commit: flang-compiler/f18@0727140f53
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 15:18:36 -07:00
peter klausler
4c5dfecb3e [flang] Let multiple CookedSource instances share a ref-counted AllSources.
Original-commit: flang-compiler/f18@98a170e3e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 14:58:14 -07:00
peter klausler
108e9b4678 [flang] Support resolution of provenances in messages from CharBlocks to ProvenanceRanges
Original-commit: flang-compiler/f18@aa57287959
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 14:01:19 -07:00
peter klausler
28ed1390cd [flang] complete merge to current master
Original-commit: flang-compiler/f18@ca43f45616
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 13:38:24 -07:00
peter klausler
fa30061f09 [flang] fix double deallocation bug from previous commit
Original-commit: flang-compiler/f18@f216b6bb82
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 13:27:33 -07:00
peter klausler
544f9d5e74 [flang] Tweaks to provenance data structures, in preparation for better module file support.
Original-commit: flang-compiler/f18@a7b7b2b680
Reviewed-on: https://github.com/flang-compiler/f18/pull/151
Tree-same-pre-rewrite: false
2018-07-27 13:27:30 -07:00
Tim Keith
4790f692f5 [flang] Merge pull request flang-compiler/f18#149 from flang-compiler/tsk5
Refactor ModFileReader to use parser::Parsing

Original-commit: flang-compiler/f18@451e9e4ee4
Reviewed-on: https://github.com/flang-compiler/f18/pull/149
2018-07-27 10:57:29 -07:00
Tim Keith
11225c978b [flang] Remove unnecessary unique_ptr.
The unique_ptr around the vector of char was unnecessary. We can just
move the vector itself and it still keeps the same stream of chars.

Original-commit: flang-compiler/f18@24672adba9
Reviewed-on: https://github.com/flang-compiler/f18/pull/149
2018-07-27 08:12:37 -07:00
Tim Keith
6f4f772685 [flang] Change how cooked source is saved
Rather than save the entire CookedSource object in the module scope,
all we need is the vector of characters that CharBlock has references
into. This avoids the problem that CookedSource object has a dangling
reference to an AllSources object (which shouldn't be needed by the
CharBlocks in the symbol table, but is there).

This also decouples Scope from parser classes other than CharBlock.

Original-commit: flang-compiler/f18@fdbf5c841e
Reviewed-on: https://github.com/flang-compiler/f18/pull/149
Tree-same-pre-rewrite: false
2018-07-26 16:03:31 -07:00
Tim Keith
9e48304374 [flang] Refactor ModFileReader to use parser::Parsing
parser::Parsing does most of the work needed to prescan and parse a file.
The only problem is that for module files we need to take ownership of
the cooked character stream so that it lives as long as the module scope
does.

To achieve this, change Parsing::cooked_ to be a unique_ptr and add a
member function to allow the caller to take ownership of it.

Original-commit: flang-compiler/f18@9088891ab2
Reviewed-on: https://github.com/flang-compiler/f18/pull/149
Tree-same-pre-rewrite: false
2018-07-26 10:57:51 -07:00
Austin Wells
fb8950ee93 [flang] Update README.md (flang-compiler/f18#150)
Corrected the URL  in README.md to point to the correct public URL for this repository.

Original-commit: flang-compiler/f18@7005e9ad7b
Reviewed-on: https://github.com/flang-compiler/f18/pull/150
2018-07-27 08:46:33 -07:00
Tim Keith
88f57c6c28 [flang] Merge pull request flang-compiler/f18#147 from flang-compiler/tsk5
Add support for -module option

Original-commit: flang-compiler/f18@e3d4d7e6fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/147
2018-07-26 10:40:27 -07:00
Tim Keith
070073426a [flang] Add support for -module option
The `-module` option specifies where to write module files. It is also
the first place search for modules files. The current options name and
behavior match PGI compilers.

To support this, reorganize `ModFileWriter` to be more like `ModFileReader`.
The gives the client a way to set the output directory and fetch the
error messages. A bunch of static member functions in `ModFileWriter`
were changed to non-member functions so they didn't need to be exposed
in `mod-files.h`.

Original-commit: flang-compiler/f18@2717846e81
Reviewed-on: https://github.com/flang-compiler/f18/pull/147
2018-07-25 17:07:38 -07:00
Peter Klausler
ba0e3ba0ef [flang] Merge pull request flang-compiler/f18#146 from flang-compiler/pmk1
OpenMP conditional compilation lines

Original-commit: flang-compiler/f18@e02c561e00
Reviewed-on: https://github.com/flang-compiler/f18/pull/146
2018-07-25 13:14:34 -07:00
peter klausler
594c554fa3 [flang] OpenMP conditional compilation lines
Original-commit: flang-compiler/f18@5602f7e041
Reviewed-on: https://github.com/flang-compiler/f18/pull/146
2018-07-25 11:44:20 -07:00
Tim Keith
f485a43ed9 [flang] Merge pull request flang-compiler/f18#145 from flang-compiler/tsk5
Implement reading of module files

Original-commit: flang-compiler/f18@2b36d4c650
Reviewed-on: https://github.com/flang-compiler/f18/pull/145
2018-07-25 10:11:38 -07:00
Tim Keith
f62f8b655d [flang] Implement reading of module files
When a use-stmt is encountered for a module that isn't in the global
scope, search for and read the appropriate `.mod` file. To perform the
search, pass the search directories in to ResolveNames.

For modules that were read from `.mod` files, we have to keep the cooked
source from being deleted so that the names so that references to names
stay valid. So we store the cooked source in the Scope of the module as
a `unique_ptr`.

Add `Symbol::Flag::ModFile` to distinguish module symbols that were read
from a `.mod` file rather than from the current compilation. Use it to
prevent writing those back out.

Fix test_errors.sh to run the compiler in the temp subdirectory --
otherwise tests could be affected by `.mod` files left from previous
tests.

Original-commit: flang-compiler/f18@207065999c
Reviewed-on: https://github.com/flang-compiler/f18/pull/145
2018-07-25 10:11:38 -07:00
Peter Klausler
9381c34f61 [flang] Merge pull request flang-compiler/f18#144 from flang-compiler/pmk0
Checkpoint development of expression analysis

Original-commit: flang-compiler/f18@a32c16f895
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
2018-07-25 09:33:37 -07:00
peter klausler
dda1d4c959 [flang] Fix typo
Original-commit: flang-compiler/f18@b9837c01da
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
2018-07-24 15:50:38 -07:00
peter klausler
7f484d7011 [flang] real expression folding
Original-commit: flang-compiler/f18@8757dc2c90
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:57 -07:00
peter klausler
35ad0036aa [flang] checkpoint
Original-commit: flang-compiler/f18@fc470dc851
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:57 -07:00
peter klausler
943b50289b [flang] Real->Integer conversion folding
Original-commit: flang-compiler/f18@5ad6505e78
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:55 -07:00
peter klausler
61c45394c0 [flang] Parameterize Expr on a type, not category+kind
Original-commit: flang-compiler/f18@f29b065d00
Reviewed-on: https://github.com/flang-compiler/f18/pull/144
Tree-same-pre-rewrite: false
2018-07-24 14:33:55 -07:00