Commit graph

59 commits

Author SHA1 Message Date
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
David Nadlinger
9f998a398d Initial merge of upstream v2.071.0-b2
Notably, the glue layer side of the changed multiple interface
inheritance layout (DMD a54e89d) has not been implemented yet.

This corresponds to DMD commit 3f6a763c0589dd03c1c206eafd434b593702564e.
2016-04-03 15:15:14 +01:00
Rainer Schuetze
4a200b7b88 fix ordering of overloads 2016-03-13 17:27:57 +01:00
Johan Engelen
acdcc4a8c1 Merge branch 'master' into merge-2.069 2016-02-13 20:12:17 +01:00
Johan Engelen
29ce4012af dmd2 --> ddmd. Merge (almost all of) our changes to dmd source into the new D source of dmd 2.069.2.
Also adds the CMake infrastructure to compile and link the D source files.

The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
2016-01-28 19:03:58 +01:00
Kai Nacke
8df1f7ec1a Add more support for xBSD type OS.
Use the same code for FreeBSD, NetBSD, OpenBSD and DragonFly BSD.
2016-01-22 22:10:33 +01:00
Martin
e7f26a94b0 Prepare generic x86 TargetABI for proper MSVC support
Based on Rainer's work in
3e36652c2c
2015-12-06 19:09:33 +01:00
Martin
fa48cabedc Some more cosmetic fixes 2015-11-02 19:54:18 +01:00
David Nadlinger
05d45350aa clang-tidy: Add readability-else-after-return 2015-11-02 11:30:40 +02:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
05c10d9107 Introduce DtoAlignment() and overload DtoAlloca() for VarDeclarations
Trying to get the alignment right by using the first non-default one
in the following order of descending priority:

VarDeclaration::alignment [variables only of course]
Type::alignment()
Type::alignsize()

This fixes `align(x) struct S { ... }`.
2015-10-18 14:38:09 +02:00