Commit graph

70 commits

Author SHA1 Message Date
Martin Kinkelin
18406bcc06 Adopt DMD's MSVC toolchain detection
This reduces the overhead for auto-detecting and setting up an MSVC
toolchain from a very rough 1 second to about 8 milliseconds on my box.
Enabling the auto-detection by default (and so preferring MSVC over the
'internal' toolchain if there's a Visual C++ installation) is now
possible, fixing issues like #3402.

The MSVC setup now consists of the bare minimum - prepending 3
directories to the LIB env var and 1-2 directories to PATH.
2020-04-30 21:45:56 +02:00
Martin Kinkelin
ff36be2c01
Do not fallback to host for critical section size of unknown targets (#3389)
Instead, error out whenever requested by an expression-less
`synchronized` statement, including source LoC to track it down.

This is safer, especially since the previous initial warning may likely
be suppressed, and makes this host-agnostic.

Also suppress previous warnings about unknown `` and `none` OS, treating
these like `unknown`.
2020-03-30 21:26:51 +02:00
Jacob Carlborg
bcb013274b Fix warning about critical section size for Apple ARM 2020-01-19 20:57:23 +01:00
Martin Kinkelin
ecaa413ccc Upgrade frontend & libs to v2.090.0-beta.1 2019-12-22 16:29:29 +01:00
Martin Kinkelin
1662406231 Upgrade front-end & libs to v2.088.0-beta.1 2019-08-25 00:36:15 +02:00
Martin Kinkelin
8da4e6f9cf
Merge pull request #3093 from kinke/merge-2.087
Upgrade front-end & libs to v2.087.1+
2019-08-06 22:21:18 +02:00
skoppe
b593dda535 return 0 in getCriticalSectionSize for wasm (#3119) 2019-07-26 21:42:01 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Nicholas Wilson
b750ce0c27
add __traits(getTargetInfo, "dcomputeTargets") (#3090) 2019-06-14 10:49:46 +08:00
Martin Kinkelin
a44c78fb88 Disallow some vector ops and fix integral vector identity comparisons
Bail out on unsupported vector ops (not checking the rhs type for binops
though) in the frontend instead of causing LLVM errors.

Also precompute the target's critical section size once at startup, like
DMD.
2019-05-26 05:11:16 +02:00
Martin Kinkelin
6c3d8b952e Add cmdline option -extern-std=c++{98,11,14,17} 2019-03-01 18:19:00 +01:00
Martin Kinkelin
5e93ed0dfd Upgrade front-end & libs to v2.085.0-beta.1 2019-03-01 18:19:00 +01:00
Martin Kinkelin
8a87cadf62 Resync gen/target.cpp with dmd/target.d 2018-12-12 12:19:17 +05:30
Joakim
1c82d12cd0 Android: change long double mangling on Android/x64 to g 2018-12-12 12:19:17 +05:30
Martin Kinkelin
22166c81b2 Add proper toArgTypes() for System V x86_64 ABI
Make the existing 64-bit code in argtypes.d DMD-specific (required due
to codegen issues) and add a new separate implementation for the SysV
x86_64 ABI to be used by LDC/GDC, closely following the algorithm laid
out in the spec [1].
Also don't needlessly compute a struct's argtypes for Win64 and
non-x86[_64] targets.

This fixes LDC ABI issues wrt. C[++] compatibility on Posix x86_64,
e.g., https://issues.dlang.org/show_bug.cgi?id=13957.

I went with signed integers to represent GP registers, and float/double/
__vector(double[N]) for vector registers (SSE + AVX); integer signedness
and vector element type are arbitrary.

[1] https://www.uclibc.org/docs/psABI-x86_64.pdf
2018-11-02 17:19:25 +01:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
0bd9a10234 Add LDC-specific support for __traits(getTargetInfo) 2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
40cf784cbe Misc. merge fixes, minor adaptions 2018-08-17 21:31:53 +02:00
Martin Kinkelin
3da5a12f4a Use 80-bit compile-time reals on Windows/MSVC hosts
Consistent with DMD and enabling seamless cross-compilation to Posix
x86(_64) targets.
2018-06-24 03:59:14 +02:00
Martin Kinkelin
acf7de3ce6 Initialize new Target::twoDtorInVtable appropriately 2018-06-20 01:52:38 +02:00
Martin Kinkelin
a133ffad56 MSVC: Port Rainer's upstream extern(C++) method ABI fixes
From https://github.com/dlang/dmd/pull/8330.
2018-06-19 20:13:02 +02:00
Martin
8583c117bc Adapt new Target::isReturnOnStack() to LDC
It's apparently used for std.traits.
2018-04-28 00:42:50 +02:00
Martin
7f6b7b9f13 Fix C long size for 64-bit MSVC target 2018-04-13 21:13:38 +02:00
Martin
6b0ca0e194 64-bit OSX: Revert to mangling (u)long as C++ (unsigned) long
Primarily not to break size_t interop. A size_t is probably much more
frequently used than `(unsigned) long long` (which Apple sadly chose for
their C++ `(u)int64_t`).
2018-04-13 21:13:38 +02:00
Martin
df4f854dd5 Upgrade to D v2.079.0-beta.1 2018-02-20 02:04:41 +01:00
Martin
197e65efde Merge branch 'master' into merge-2.078
Conflicts:
	driver/main.cpp
	gen/cl_helpers.h
	gen/declarations.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
2018-01-20 11:20:17 +01:00
Martin
27deb2ff8c Get rid of obsolete gen/llvmcompat.h
Not needed anymore since C++11.
2018-01-12 20:20:47 +01:00
Martin
cfad799f48 Merge 2.078.0 front-end and stdlibs 2018-01-06 01:39:18 +01:00
Martin
c6a9affc8f Support catching C++ exceptions for MSVC targets 2017-11-27 18:59:29 +01:00
Martin
dfe45715ba Enable catching C++ exceptions for non-MSVC targets 2017-11-26 18:41:01 +01:00
kinke
70c4c3cb74 Don't let Target::RealProperties alias Target::DoubleProperties (#2374)
Which is a serious problem if the host real_t is a double and the target
`real` features a higher precision (cross-compilation).
`Target::RealProperties` are set up for the target's `real`, so
max/min_normal/epsilon may over/underflow, and so would
`DoubleProperties` if aliased.
2017-10-25 00:18:11 +02:00
Martin
0b28925e9a Win32: Remove extra leading underscore from D symbol mangling
This is compatible with DMD.
2017-10-07 14:06:17 +02:00
Martin
3e554f2bfd Revert "OSX: Make sure T.mangleof matches the final mangle for C++ symbols"
This reverts commit c49464a57e.
2017-09-30 01:04:28 +02:00
Martin
c49464a57e OSX: Make sure T.mangleof matches the final mangle for C++ symbols
By using upstream's Target.prefixName(), which prepends an additional
underscore on OSX/Darwin for C++ symbols.
We then need to prevent LLVM from implicitly prepending a third one.
2017-09-28 20:17:02 +02:00
Martin
980c5620ec Merge branch 'master' into merge-2.075
Conflicts:
	runtime/druntime
2017-08-04 22:43:16 +02:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
c51c2c0d55 Merge 2.075.0 front-end and stdlibs 2017-07-30 03:03:28 +02:00
Martin
5dd07dcfbe Switch to special quiet NaN as init value for all FP types
As 'processing' a signalling NaN may convert it to a quiet NaN. Apparently
happening on 32-bit x86 using the x87 FPU, but not on x86_64 with SSE.

This fixes potential issues with different constants being used when
mixing natively and cross-compiled objects/libs and failing bitwise `is`
comparisons etc.

See https://forum.dlang.org/post/nsp1ql$ivu$1@digitalmars.com for Martin
Nowak's summarized findings.
2017-07-28 01:13:13 +02:00
Martin
f17ff5efe0 Don't depend on host real_t.init, use LLVM's signalling NaN instead 2017-07-28 01:09:02 +02:00
Martin
03d803419d Fix Target.RealProperties potentially aliasing Target.DoubleProperties
In case the host real_t is double (e.g., for MSVC hosts).
2017-06-10 04:30:43 +02:00
Martin
090031cd43 Upgrade front-end + libs to v2.074.1 2017-06-10 03:09:40 +02:00
Martin
85e004fdec Merge branch 'master' into merge-2.074
Conflicts:
	runtime/druntime
2017-05-16 21:16:43 +02:00
Nikolay
25144d6a88 NetBSD: fix mutex size (#2109) 2017-05-12 11:17:23 +02:00
Martin
f70a51a18c Merge 2.074.0 front-end 2017-04-22 03:52:58 +02:00
Martin
0e71a760ae Limited support for arbitrary target reals
While parsing of floating-point literals and CTFE still operate with the
host LDC's real type, compile-time reals can in principle be emitted in
arbitrary precision via LLVM software conversion, therefore paving the way
for cross-compilation to all targets.

The representable constants are still limited by the compile-time real_t
precision. E.g., LDC on Windows with its 64-bit reals can't hold and emit
an 80-bit `real.max` when cross-compiling to a non-Windows x86(_64)
target; the compile-time value will silently overflow to infinity and
later be emitted as 80-bit infinity.

LDC on AArch64 with its 128-bit quad-precision reals on the other hand can
hold and emit reals for all targets, making it a universal cross-compiler
with quad-precision compile-time reals in hardware.

We don't use the strange 2x64-bit PPC double-double format (see
`getRealType()` in `ir/irtype.cpp`), but would more or less support it
(the type properties (max, min_normal...) still need to be determined;
LLVM isn't sure about those either...).
2017-02-11 14:24:46 +01:00
Martin
7c1e4a74ce Fix C++ mangling of real: __float128 => long double 2017-02-03 23:13:24 +01:00
Martin
de0708e99b Fix compilation error for LLVM 4.0+ 2017-02-01 20:49:42 +01:00
Martin
dca21939e1 Merge 2.072.2 front-end
The part needing most attention was ddmd.root.ctfloat, ddmd.target (incl.
gen/target.cpp) and ddmd.builtin. The front-end is now prepared for
elaborate compile-time floating-point types to allow for proper cross-
compilation.

This version still uses the host's `real` type for compile-time reals,
except for MSVC hosts, which still use 64-bit doubles (when compiled with
DMD host compiler too).

Some other changes:

* semantic*() of Statements extracted from statement.d to statementsem.d
* mangle() -> mangleToBuffer()
* Identifier::string -> toChars()
* Token::float80value => floatvalue
* Dsymbol::isAggregateMember() => isMember()
* BoolExp is no more
* ddmd.root.ctfloat: LDC-specific CTFE builtins
2017-01-29 15:48:03 +01:00
kinke
bb3e16481c Fix alignment and size of target critical section (#1956)
The missing alignment is a front-end bug; this is a combined backport
of dlang/dmd@b9aa6ed and dlang/dmd@a93fa3c.

For POSIX targets, the critical section size was assumed to be identical
to the host compiler's, which generally isn't true when cross-compiling.

DtoMutexType() wasn't used anywhere, so I removed it.
2017-01-13 21:44:28 +01:00