Commit graph

98 commits

Author SHA1 Message Date
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
Martin Kinkelin
5451a072a8
Refactoring: Free TargetABI from legacy magic C++ structs (#3073)
Which have been superseded by magic enums (in core.stdc.config).
2019-07-01 21:48:01 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
5e93ed0dfd Upgrade front-end & libs to v2.085.0-beta.1 2019-03-01 18:19:00 +01:00
Martin Kinkelin
32ecbdd266 Upgrade front-end & libs to v2.084.0-beta.1 2018-12-18 02:31:57 +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
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
78ce63efa5 UnknownTargetABI: Pass static arrays with byval attribute
This should be a more sensible default behavior, treating a static array
like a struct with the corresponding number of fields.
2018-06-19 20:15:06 +02:00
Martin Kinkelin
9b6b256399 Fix TargetABI::isPOD() for static arrays of non-PODs 2018-06-19 20:13:03 +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 Kinkelin
3ca43c51b8
Use IndirectByvalRewrite for non-POD args and extern(C++) on Posix (#2728)
Fixing one aspect of issue #2702; not tackling the different destruction
rules yet.
2018-06-19 20:09:35 +02:00
Martin Kinkelin
29d609d63d Refactoring: Introduce TargetABI::reverseExplicitParams() 2018-05-30 22:42:00 +02:00
Martin Kinkelin
92913d4c08 Store front-end D function type in IrFuncTy
As we do for IrFuncTyArg. We'll need access to the front-end linkage for
the Posix ABIs too in order to implement indirect-by-value passing of
non-PODs for `extern(C++)`.
2018-05-30 22:41:48 +02:00
Martin Kinkelin
8faab8b684 Refactoring: Add ABIRewrite::applyTo() for convenience
Allowing the ABIRewrite to adapt the IrFuncTyArg appropriately and
reducing code duplication.
2018-05-26 22:09:37 +02:00
Martin
d983cd01c5 Add support for new magic structs __c_(u)longlong
To be mangled as C++ (unsigned) long long.

For MSVC targets, D (u)long is C++-mangled as (unsigned) long long, so
there's no need for these magic structs.

For 32-bit POSIX targets, D (u)long is also a natural fit already.

For 64-bit POSIX targets however, D (u)long is C++-mangled as (unsigned)
long, so there's no corresponding D type, and these magic structs are
needed. Especially since macOS defines `int64_t` as `long long`, unlike
Linux (`long`).
2018-04-13 21:13:38 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Martin
82005009e7 Refactor and fix intrinsics for variadic functions
I.e., va_start(), va_copy() and va_arg().
2016-06-28 22:40:14 +02:00
Martin
de9149f1b6 Remove getLVal() from DValue and add DtoL/RVal() overloads 2016-06-13 22:30:16 +02:00
Martin
963a10b225 Let DValue types handle memory-only types consistently
I.e., disallow memory-only values from being represented as DImValues
and disallow getRVal() for such types instead of returning the address.
2016-06-13 22:30:14 +02:00
Martin
e3e2f4b2e9 DValue: Remove method getType()
Use the existing public field directly instead.

It's shorter and different than LLValue's getType() (making it easier
to discriminate DValues and LLValues for experienced LDC devs imho).
2016-06-13 22:30:13 +02:00
Martin
769dac1b1f Remove obsolete helper ABIRewrite::storeToMemory() 2016-05-29 10:41:23 +02:00
Martin
fc6c340661 Optimize ABIRewrite system for lvalues
Allow ABIRewrites to return the D parameter's LL value directly.
Most rewrites store to memory anyway, so let the D parameter point
directly to that memory instead of a dedicated alloca bitcopy.
2016-05-28 21:03:56 +02:00
Dan Olson
cd216538f9 Merge branch 'master' into objc-wip 2016-04-08 22:38:39 -07:00
Johan Engelen
823a9efe26 Merge branch 'ltsmaster'
Solved merge conflicts in:
	gen/abi.cpp
	gen/toir.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
	tests/lit.site.cfg.in
2016-03-29 11:40:20 +02:00
Kai Nacke
c1c7846e74 Introduce new ABI class for PPC64LE.
The ABI for PPC/PPC64 big-endian is quite similar.
But the ABI for PPC64 little-endian is more like the ARM ABI.
2016-03-28 03:14:00 +02:00
Dan Olson
462b089492 Move Objective-C runtime choice to TargetABI 2016-03-23 23:54:49 -07:00
Kai Nacke
6e0badadf1 Merge remote-tracking branch 'origin/ltsmaster' 2016-03-13 16:44:07 +01:00
Kai Nacke
412aa04ef6 Linux/AArch64: More ABI implementation.
This is still not perfect but already fixes some test failures.
2016-03-12 20:44:19 +00:00
Johan Engelen
acdcc4a8c1 Merge branch 'master' into merge-2.069 2016-02-13 20:12:17 +01:00
Kai Nacke
96b452b218 Add armeb/thumbeb to abi switch 2016-02-06 16:43:30 +01:00
Dan Olson
b9b4564d22 Implement ARM AAPCS ABI
This is the bulk of the AAPCS (Procedure Call Standard for the ARM
Architecture) used for C interop.  This will be used for both arm and
thumb target triples.  The extern(D) ABI tries to follows the AAPCS with
a few exceptions.
2016-02-05 09:04:09 -08: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
Martin
b8de3531a8 Fixes and adaptations for generic x86 and Win64 TargetABIs
* x86: Return most POD aggregates <= 8 bytes in registers
  * For extern(D), as in official Win32 D ABI specs [previously: sret]
  * For all other calling conventions too, except for Linux and NetBSD
    [previously: OSX and MSVC only]
* MSVC++ and extern(C++): treat structs with constructors as non-POD,
                          for both x86 and Win64 ABIs
* Win64: Pass and return magic C++ structs directly as LL aggregates,
         rendering MSVCLongDoubleRewrite obsolete
* x86: Fix regression introduced by previous commits wrt. passing the
       last struct argument in EAX register
2015-12-08 19:15:15 +01:00
Martin
0a758b180f Refactor TargetABI helpers 2015-12-06 17:42:47 +01:00
Martin
ddfaac10b3 Rename DtoAggrCopy/ZeroInit() to DtoMemCpy/SetZero() overloads
And replace some obvious load->store combos by a memcpy.
2015-12-04 22:23:09 +01:00
Martin
740a21eb8f Rename DtoIsPassedByRef() to DtoIsInMemoryOnly()
Motivation: issue #937
2015-12-04 22:23:09 +01:00
Martin
fae3650f40 Fix 2 aesthetic clang-tidy glitches 2015-11-02 19:28:20 +01: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
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
Martin
80c677be46 Slightly refactor ABIRewrite interface for clarification
* put(): pass DValue alone, without explicit D type
* get(): pass LLValue instead of a faked DValue
2015-09-26 00:30:24 +02:00
Martin
9e194bfe2c Refactor store-to-new-alloca code occurrences. 2015-09-25 17:12:42 +02:00
Martin
4b6bd7ab52 Merge branch 'master' into merge-2.067 2015-07-18 16:02:51 +02:00
Kai Nacke
4cf4690ab0 Use C calling convention for variadic functions on x86.
0.15.1 used stdcall convention everywhere. But the ABI change in 0.15.2
requires use of the C calling convention for variadic calls on x86
because the stdcall convention does not support vararg functions.

Solution is to check the llvm::FunctionType if the function has varargs.
This commit also makes the C calling convention the global default
because according to the LLVM documentation the fastcc convention used
for D linkage does not support varargs.

This fixes issue #1000.
2015-07-15 21:34:00 +02:00
David Nadlinger
7af77ab141 Fix va_list mangling for System V AMD64 2015-06-07 19:18:58 +02:00
kai
84b09dc658 Merge branch 'master' into merge-2.067
Conflicts:
	gen/abi.cpp
	runtime/druntime
2015-05-18 07:28:56 +02:00
kai
ca3915edcb Add minimal ABI class for MIPS.
Without this ABI class it is not possible to compile vararg funtions.
2015-05-18 06:53:58 +02:00
Kai Nacke
8aabe36b43 Add ABI class for AArch64.
With this class most compile errors are fixed.
Notable exceptions are std.math and core.stdc.stdarg.
2015-05-04 19:05:28 +02:00
Martin
b45cc2e478 Do not read from undefined bytes when bit-casting.
Apparently required for LLVM 3.2.
2015-02-24 19:37:26 +01:00