Commit graph

230 commits

Author SHA1 Message Date
peter klausler
51dc18258b [flang] remove debugging output
Original-commit: flang-compiler/f18@3a156953c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
Tree-same-pre-rewrite: false
2019-01-09 15:13:23 -08:00
peter klausler
dc9faa270f [flang] cherrypick expression changes
Original-commit: flang-compiler/f18@427e267722
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
Tree-same-pre-rewrite: false
2019-01-09 15:06:07 -08:00
Paul Henning
778e615158 [flang] Added preprocessor directives to limit the use of non-inline ExpressionBase<A>::derived to GCC on Mac (inlined on all other platforms)
Original-commit: flang-compiler/f18@b38b31909a
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
2019-01-03 09:45:27 -07:00
Paul Henning
b61b31dfcd [flang] Addresses issue flang-compiler/f18#242 by making non-inline definitions for the two versions
of ExpressionBase::derived().  gcc-8.2 on macOS was choosing to create
non-inline instances of derived() during the explicit instantiations of
ExpressionBase in expression.cc and fold.cc.  During linking of any
executable, the linker failed when it found these duplicate definitions.

While this solution works, it removes the opportunity to inline the trivial
derived() functions.  Another solution would be to make all of the
templates related to ExpressionBase in expression.cc and fold.cc available
in a single .cc file, where the explicit instantiation
FOR_EACH_TYPE_AND_KIND(template class ExpressionBase) is done once. This
approach would allow inlining, but require something like template
implementation headers that could be included into the instantiation .cc
file.

Original-commit: flang-compiler/f18@074de39418
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
Tree-same-pre-rewrite: false
2018-12-20 10:39:29 -07:00
peter klausler
e760aaa4e6 [flang] fix copyright dates
Original-commit: flang-compiler/f18@75818658d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
Tree-same-pre-rewrite: false
2019-01-07 15:50:04 -08:00
peter klausler
e828e0c795 [flang] Update copyright dates.
Original-commit: flang-compiler/f18@8a7722621b
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
Tree-same-pre-rewrite: false
2019-01-07 15:42:36 -08:00
peter klausler
13ed85789d [flang] Symbol changes for PDT instantiation
Original-commit: flang-compiler/f18@0c545a026d
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
Tree-same-pre-rewrite: false
2019-01-07 15:05:53 -08:00
peter klausler
67f13efa44 [flang] update copyright dates
Original-commit: flang-compiler/f18@99f4c98ccb
Reviewed-on: https://github.com/flang-compiler/f18/pull/252
2019-01-07 10:55:09 -08:00
peter klausler
fe3acf5ffc [flang] Roll up folding & expression changes
Original-commit: flang-compiler/f18@60affece05
Reviewed-on: https://github.com/flang-compiler/f18/pull/252
Tree-same-pre-rewrite: false
2019-01-07 10:15:27 -08:00
peter klausler
2ad9986698 [flang] Support operator== for expressions.
Original-commit: flang-compiler/f18@42013513e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/251
2019-01-04 14:05:53 -08:00
Tim Keith
9c35cb8948 [flang] Handle TypeStar and ClassStar in GetSymbolType()
Add DeclTypeSpec::AsDerived() to get the DerivedTypeSpec from a
DeclTypeSpec when it has one.

Original-commit: flang-compiler/f18@3bd921d8f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/247
2018-12-17 17:22:42 -08:00
Tim Keith
b8b53ba2f4 [flang] Refactoring: improve some names
IntrinsicTypeSpec was used for all intrinsics except for character.
Change it to be a common base class for NumericTypeSpec,
LogicalTypeSpec, and CharacterTypeSpec.

Change DeclTypeSpec to categorize the intrinsics as Numeric, Logical,
and Character. Add some utility methods: AsIntrinsic() and IsNumeric().

In scope.h, give the functions that create DeclTypeSpecs better names.

In semantics.h, replace MakeIntrinsicTypeSpec() with MakeNumericType()
and MakeLogicalType() as it does not apply to character types.

Original-commit: flang-compiler/f18@8ad92d069c
Reviewed-on: https://github.com/flang-compiler/f18/pull/247
Tree-same-pre-rewrite: false
2018-12-17 12:41:43 -08:00
peter klausler
8b34535de7 [flang] fix bug noticed by Jean
Original-commit: flang-compiler/f18@9acbff7585
Reviewed-on: https://github.com/flang-compiler/f18/pull/244
2018-12-14 13:19:12 -08:00
peter klausler
8b580e4591 [flang] fix crash that Tim ran into
Original-commit: flang-compiler/f18@498a8c6fb8
Reviewed-on: https://github.com/flang-compiler/f18/pull/245
2018-12-14 11:23:14 -08:00
Tim Keith
a3b09ef72a [flang] Fix bug converting actual argument to Fortran
This fixes a problem with converting the ubound call in the example
below back to Fortran (in this case, for writing to the .mod file).
One of the ActualArguments encountered in ProcedureRef::AsFortran is
a `std::nullopt`, so we need to handle that case.

```
module m
  real :: x(10)
  real :: y(ubound(x, dim=1))
end module
```

Original-commit: flang-compiler/f18@c5ace6b824
Reviewed-on: https://github.com/flang-compiler/f18/pull/240
2018-12-07 07:41:49 -08:00
Tim Keith
8ae55f79bc [flang] Rework when symbol table expressions are evaluated
It's not good enough to evaluate expressions in the symbol table after
name resolution has completed. This is because we need the values of
constant expressions for types, for example, we need to evaluate `k` in
`integer(k) :: x` to know the type of `x`.

So, eliminate `LazyExpr` and call `EvaluateExpr()` on expressions that
we need in the symbol table. The latter evaluates and folds an
expression in the current context. This is now possible because symbols
are added to `parser::Name` as soon as possible rather than in a pass
after name resolution. Along with `LazyExpr` we can eliminate the whole
`ResolveSymbolExprs` pass that used to resolve them.

In resolve-names.cc, many `Pre` functions are changed to `Post` so that
names are resolved before doing the associated processing. For example,
with intrinsic type specs, names in the kind expression must be resolved
before attempting to evaluate that expression.

In `GetSymbolType()` in type.cc, handle both `ObjectEntityDetails` and
`EntityDetails` by using `Symbol::GetType()`.

Add explicit declarations in label01.F90 because we can't handle
implicitly typed array bounds yet.

Original-commit: flang-compiler/f18@d67716640b
Reviewed-on: https://github.com/flang-compiler/f18/pull/238
2018-12-06 07:16:52 -08:00
Tim Keith
d6b37b1967 [flang] Fix error is Negation on integer
The minus sign was missing.

Original-commit: flang-compiler/f18@5fa0a97de5
Reviewed-on: https://github.com/flang-compiler/f18/pull/238
Tree-same-pre-rewrite: false
2018-12-06 07:16:52 -08:00
peter klausler
1b1f60ff50 [flang] Use std::optional<>::value() where appropriate.
Original-commit: flang-compiler/f18@4278b79b3d
Reviewed-on: https://github.com/flang-compiler/f18/pull/237
Tree-same-pre-rewrite: false
2018-12-05 13:03:39 -08:00
peter klausler
34642dab32 [flang] fixes
Original-commit: flang-compiler/f18@d312b2298a
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
2018-12-03 17:20:28 -08:00
peter klausler
972e4b59d5 [flang] address review comments
Original-commit: flang-compiler/f18@2f4b7ac97c
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
Tree-same-pre-rewrite: false
2018-12-03 16:44:25 -08:00
peter klausler
659c32947c [flang] checkpoint during refactor
Original-commit: flang-compiler/f18@01fe82b95b
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
Tree-same-pre-rewrite: false
2018-11-30 14:03:05 -08:00
peter klausler
a0a60e8d6a [flang] address TODO: replace Type flag member with IsSpecificIntrinsicType<T> predicate
Original-commit: flang-compiler/f18@68b89c008f
Reviewed-on: https://github.com/flang-compiler/f18/pull/233
2018-11-29 10:25:46 -08:00
Tim Keith
daa0b054ba [flang] Change formatting of common::visitors{}
Including a comma after the last lambda in a `common::visitors{}` list
causes clang-format to do a better job of formatting them.

Add that recommendation to C++style.md, insert the missing commas,
and reformat the changed files.

Original-commit: flang-compiler/f18@a2486ca3b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/232
2018-11-29 09:27:34 -08:00
peter klausler
2067929b5a [flang] tested
Original-commit: flang-compiler/f18@e77681a2ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/231
Tree-same-pre-rewrite: false
2018-11-28 16:20:16 -08:00
peter klausler
7f603f6e15 [flang] debugged full precision FP formatting
Original-commit: flang-compiler/f18@ac9a684b91
Reviewed-on: https://github.com/flang-compiler/f18/pull/231
Tree-same-pre-rewrite: false
2018-11-28 10:33:09 -08:00
peter klausler
2fe5b128bd [flang] debugging
Original-commit: flang-compiler/f18@9f30eac130
Reviewed-on: https://github.com/flang-compiler/f18/pull/231
Tree-same-pre-rewrite: false
2018-11-28 10:33:09 -08:00
peter klausler
1df60f3ceb [flang] initial exact decimal conversion code
Original-commit: flang-compiler/f18@a34afdc73b
Reviewed-on: https://github.com/flang-compiler/f18/pull/231
Tree-same-pre-rewrite: false
2018-11-28 10:33:08 -08:00
peter klausler
791ef8c407 [flang] fix comments
Original-commit: flang-compiler/f18@a01eaaacc2
Reviewed-on: https://github.com/flang-compiler/f18/pull/228
Tree-same-pre-rewrite: false
2018-11-19 10:29:35 -08:00
peter klausler
aa34fc6042 [flang] review comments
Original-commit: flang-compiler/f18@32c02cb668
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
2018-11-14 14:35:10 -08:00
peter klausler
c41e8706d5 [flang] remove unused variable
Original-commit: flang-compiler/f18@64773cef2c
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-13 16:26:26 -08:00
peter klausler
a10b7bc006 [flang] revamp Real::Read(), use it for mutual testing of ScaledDecimals
Original-commit: flang-compiler/f18@a2054bb9df
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-13 16:02:52 -08:00
peter klausler
bf7c03dbfb [flang] binary->decimal conversion for module files
Original-commit: flang-compiler/f18@6364799e7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-13 11:29:54 -08:00
peter klausler
c4601e2bc2 [flang] save work in progress
Original-commit: flang-compiler/f18@98bac3d297
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:04 -08:00
peter klausler
4f6275a1f7 [flang] Rename Dump() as AsFortran(), tweak output for use in .mod files
Original-commit: flang-compiler/f18@4e9dd16d6a
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:03 -08:00
peter klausler
10aa1eafa0 [flang] multi-byte character TODOs
Original-commit: flang-compiler/f18@3bd2d227dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:02 -08:00
peter klausler
4e56600a8a [flang] more substring clean-up
Original-commit: flang-compiler/f18@e1c19ccd16
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:02 -08:00
peter klausler
3eb69047df [flang] BaseObjects and static data placeholder
Original-commit: flang-compiler/f18@3ddfd5cadf
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:37:58 -08:00
peter klausler
fdd006ea28 [flang] small tweaks
Original-commit: flang-compiler/f18@5bbd6c3c19
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:37:17 -08:00
peter klausler
cfb57cd2d3 [flang] take literal substrings out of variable.h
Original-commit: flang-compiler/f18@a762b70beb
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:37:15 -08:00
peter klausler
e364b3db8e [flang] allow array constructors in all expressions
Original-commit: flang-compiler/f18@6dd5431cd9
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:35:48 -08:00
peter klausler
a98e682d7b [flang] represent array constructors
Original-commit: flang-compiler/f18@74ccff6b39
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:35:47 -08:00
peter klausler
72fd06b389 [flang] Clean up Designator and GetSymbol()
Original-commit: flang-compiler/f18@61c0af323c
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:35:46 -08:00
peter klausler
59c1233036 [flang] Make all Expr<> instances derived from ExpressionBase
Original-commit: flang-compiler/f18@f7d1a21532
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:33:57 -08:00
peter klausler
03618fd5e3 [flang] Address TODO: define IsAssumedRank predicate, use it
Original-commit: flang-compiler/f18@f75c3e0ccf
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:33:57 -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
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
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