Commit graph

309 commits

Author SHA1 Message Date
Jean Perier
1d4323ddd5 [flang] Silence GCC 8.1 spurious warning
Original-commit: flang-compiler/f18@69e05d0632
Tree-same-pre-rewrite: false
2019-03-28 02:34:32 -07:00
Steve Scalpone
1de9ecd251 [flang] Add CMake rules to install static and shared libraries in
the default install directory or in the directory specified
with CMAKE_INSTALL_PREFIX.  Fixes flang-compiler/f18#359.

Original-commit: flang-compiler/f18@35ce1628e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/364
2019-03-28 09:55:56 -07:00
Jean Perier
236eeef974 [flang] Only have cmake look for libpgmath if LIBPGMATH_DIR is given
Original-commit: flang-compiler/f18@1d778f5c1a
2019-03-27 10:16:07 -07:00
Jean Perier
be5cfaa5c7 [flang] fix clang errors and warnings
Original-commit: flang-compiler/f18@410f96384f
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
cabcd851e6 [flang] Prepare to be merged with master branch
ActualArgument was modified in the master branch from
a struct to class. In order to compile once merged, this PR
required the related access paterns to be adapted to match
the new ActualArgument.
As a consequence, this PR does not compile anymore on its own,
it needs to be merged with the master branch to work.

Original-commit: flang-compiler/f18@48cdd2ed0e
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
167730fd91 [flang] Enable folding of some more intrinsic functions
Enable folding of the following 80 intrinsic functions:

+ Without runtime:

++ Integer:
abs, dim, dshiftl, dshiftr, exponent, iand, ibclr, ibset, ieor, int,
ior, ishft, kind, len, leadz, maskl, maskr, merge_bits, popcnt, poppar,
shifta, shiftl, shiftr, trailz

++ Real:
abs, aimag, aint, dprod, real

+ Complex:
cmplx, conjg

++ Logical:
bge, bgt, ble, blt

+ With Runtime :

+ Real:
acos, acosh, asinh, atan, atan2, atanh, bessel_j0, bessel_j1,
bessel_jn (elemental), bessel_y0, bessel_y1, bessel_yn (elemental),
cos, cosh, erf, erfc, erfc_scaled, exp, gamma, hypot, log, log10,
log_gamma, mod, sin, sqrt, sinh, sqrt, tan, tanh

++ Complex:
acos, acosh, asin, asinh, atan, atanh, cos, cosh, exp, log, sin,
sinh, sqrt, tan, tanh

Original-commit: flang-compiler/f18@7e7d1920f8
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
dc3cca3427 [flang] make HostIntrinsicProceduresLibrary a class
Original-commit: flang-compiler/f18@b9f5015d4d
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
aeb7cef41a [flang] add the possibility to use libpgmath for constant folding
Original-commit: flang-compiler/f18@948a665627
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
9147534f13 [flang] Map more intrinsic functions to <cmath> functions
Original-commit: flang-compiler/f18@f0f2062211
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
e3b74caa0d [flang] Move host floating point environment handling in host.h/host.cc
Original-commit: flang-compiler/f18@0cba8b1308
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
ca0261b253 [flang] Removed dynamic loading feature for intrinsic folding
After more reflexion, dynamic loading brings to much uncertainty
regarding which library is actually being use for folding.
It is removed to avoid pushing people to use it.
A static linking to libpgmath will be provided in a later commit.

Original-commit: flang-compiler/f18@2161627d28
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
9ce02da63a [flang] fix clang++ linking issue with libm
Original-commit: flang-compiler/f18@805c861bd0
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
8d032dc96b [flang] renaming to focus scope on intrinsic runtime
Original-commit: flang-compiler/f18@7cfd33b178
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
fa3a179fec [flang] made fenv errors internal errors
Original-commit: flang-compiler/f18@f776c8db91
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
a955f3e51c [flang] fix signed/unsigned comparison
Original-commit: flang-compiler/f18@46148712e1
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
4fdf4fa18d [flang] Limits C++ implementation behaviors
The issue addressed here is the use of cast between object pointers
and function pointers. It is implementation defined because C++,
just like C, does not mandate that function and object pointers
must have the same size.
It is needed to have such cast because it is a will to ba able to
call inside F18 numerical function from libraries linked during
a Fortran program compilation in order to perform folding.
dlopen returns function pointers as void* that need to be cast to
pointer before use.
This change limits the usage of such cast inside ifdefs where POSIX
is required. In POSIX context, such cast is defined. Dlopen is
anyway used only if the environment is POSIX compliant.
In the rest of the code, opaque function pointers have been changed
from void* to void*(*)(). reinterpret_cast from function pointer to
function pointer are standard compliant.

Original-commit: flang-compiler/f18@4b2f29a128
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
dd2c2d5798 [flang] fixed use before init in elemental folding helper
Original-commit: flang-compiler/f18@2cea43ddf9
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
faddfde12f [flang] add support to fold elemental intrisics over arrays
Original-commit: flang-compiler/f18@c2fec22856
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
54d7cdbbe0 [flang] answer comments on host/f18 type mappings
Original-commit: flang-compiler/f18@96bce5c4d9
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
deff1c6a23 [flang] Adds the possibility to use part of libpgmath for folding if it is available
Original-commit: flang-compiler/f18@1c2093ff32
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
6fbbcfcb49 [flang] answer some comments
Original-commit: flang-compiler/f18@8161f77f60
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
9b1d928990 [flang] Use new indirection layer to host runtime in folding
Original-commit: flang-compiler/f18@e8bb9c52af
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
94aa34c3b2 [flang] Add RTE description structure and indirection layer to host runtime for folding
Original-commit: flang-compiler/f18@329a614052
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
63cdc3b0d3 [flang] Cherry picking commits from #PR275 and simplifying it
Commit was: Draft of elemental intrinsics function folding

Simplification was made in order to solve conflicts and
to prepare for commit of host math library indirection.

Conflicts:
	lib/evaluate/fold.cc

Original-commit: flang-compiler/f18@45678bc44c
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
4e0804ec77 [flang] Add a utility to safely interact with host types
Original-commit: flang-compiler/f18@32cd789dc2
Tree-same-pre-rewrite: false
2019-03-27 10:16:07 -07:00
Jean Perier
55c01aa295 [flang] Fix .NOT. folding bug
Original-commit: flang-compiler/f18@dd4d9091f1
Tree-same-pre-rewrite: false
2019-03-21 08:33:14 -07:00
peter klausler
dfc1643f3f [flang] get clean compile
Original-commit: flang-compiler/f18@3a606d804d
Reviewed-on: https://github.com/flang-compiler/f18/pull/346
Tree-same-pre-rewrite: false
2019-03-20 13:44:00 -07:00
peter klausler
c090abef3b [flang] checkpoint
Original-commit: flang-compiler/f18@1e213f3fbe
Reviewed-on: https://github.com/flang-compiler/f18/pull/346
Tree-same-pre-rewrite: false
2019-03-20 13:11:49 -07:00
peter klausler
ad057a42fa [flang] Remove OwningPointer, use unique_ptr better instead.
Original-commit: flang-compiler/f18@89aff868aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/346
Tree-same-pre-rewrite: false
2019-03-20 11:38:45 -07: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
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
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
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
peter klausler
c7cfc3f357 [flang] Add ForwardReference<> + documentation + clean-up
Original-commit: flang-compiler/f18@09e9501951
Reviewed-on: https://github.com/flang-compiler/f18/pull/314
2019-03-04 15:15:08 -08:00
peter klausler
b8db689ffe [flang] Fix accidentally modified comment
Original-commit: flang-compiler/f18@7d0b365a6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
Tree-same-pre-rewrite: false
2019-03-04 13:44:04 -08:00
peter klausler
b67a04c0bb [flang] check out with all versions
Original-commit: flang-compiler/f18@0b1369ce55
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
Tree-same-pre-rewrite: false
2019-03-04 11:55:10 -08:00
peter klausler
5c4faecc0d [flang] Fix flang-compiler/f18#312
Original-commit: flang-compiler/f18@625ffb4f1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
Tree-same-pre-rewrite: false
2019-03-04 11:23:50 -08:00