Commit graph

129 commits

Author SHA1 Message Date
Hiroki Noda
ff831b9394 Fix #3250: use originalLType->isAggregateType() in assertion (#3251) 2019-12-10 00:01:57 +01:00
Martin Kinkelin
18a460683f Posix x86_64: Pass non-POD arguments indirectly by value, not just for extern(C++)
Streamlining the D ABI with the C++ one and preventing extra blits for
rvalue arguments. Non-POD arguments passed by value aren't blitted into
the callee params stack any longer, but passed by reference, either
directly (rvalue args) or as reference to a bitcopy on the caller stack
(lvalue args).

This is also a prerequisite for a potential DIP1014 (opPostMove)
implementation, as LLVM (via its `byval` attribute) has been performing
the move/blit implicitly as part of the call, with no way for us to
invoke the post-move hook afterwards in the callee with the address of
the original argument.
2019-10-26 16:43:20 +02:00
Martin Kinkelin
1fdf330346 Refactoring: Remove obsolete AttrBuilder wrapper
It was useful when we still supported older LLVM versions, but it's
obsolete now.
2019-03-31 19:18:56 +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
896d5cef93 gen/abi-x86-64.cpp: Try to reuse cached arg{1,2}type of StructDeclarations 2018-11-02 17:19:25 +01:00
Martin Kinkelin
5e6c3e8a07 Slightly simplify gen/abi-x86-64.cpp 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
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
bd3a8acd5a AArch64: Fix va_list handling for variadics 2018-08-09 21:06:02 +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
93515eb32e
Merge pull request #2719 from kinke/stable
Upgrade to upstream `stable`
2018-06-01 20:42:44 +02:00
Martin Kinkelin
43296da0a2 Upgrade to upstream stable (0c4d5bb5) 2018-05-31 17:22:09 +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
915a5acd25 Try to elide bitcopy for IndirectByvalRewrite
For rvalues which are already in memory.
2018-05-30 21:46:39 +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
df4f854dd5 Upgrade to D v2.079.0-beta.1 2018-02-20 02:04:41 +01:00
Martin
1941ea0b7b Refactoring: Make DtoAllocaDump(DValue*) overloads handle DLValues 2018-01-14 22:42:27 +01:00
Martin
d996cfe873 Revise ABIRewrite::put() 2018-01-14 02:30:54 +01:00
Martin
183f97cd4e Objective-C: Fix functions with selector (issue #2387) 2017-10-26 17:01:02 +02:00
kinke
feb4ebd1ad Fix ABI issue #1925 (#1938) 2016-12-22 18:04:01 +01: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
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
dd21a805ee Trim signature of method ABIRewrite::type() 2016-05-29 11:04:29 +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
Rainer Schuetze
c74d4c2231 Merge remote-tracking branch 'remotes/origin/master' into merge-2.071
# Conflicts:
#	runtime/druntime
#	tests/d2/dmd-testsuite
2016-04-17 21:24:56 +02: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
Dan Olson
462b089492 Move Objective-C runtime choice to TargetABI 2016-03-23 23:54:49 -07: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
7c544be9d1 Respect explicit type alignments for LL args passed im- and explicitly by value
And for sret args too, except for MSVC targets.

At least on Win64, the sret align attributes lead to ICEs for std.bitmanip
and std.uni (release only), when computing the known alignment in the LLVM
inliner pass:

Assertion failed: I->getParent()->getParent() ==
Q.CxtI->getParent()->getParent() && "Got assumption for the wrong function!",
file C:\LDC\llvm\lib\Analysis\ValueTracking.cpp, line 711
2015-12-04 23:25:06 +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
fa48cabedc Some more cosmetic fixes 2015-11-02 19:54:18 +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
David Nadlinger
0b4bcbc28c Merge pull request #1181 from kinke/attribs
Simplify working with LLVM attributes
2015-11-01 17:52:45 +02:00
Martin
90197d6c72 Simplify working with LLVM attributes 2015-11-01 16:19:27 +01: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
b13565c17e Refactor common i1ToI8(voidToI8(DtoType(...))) code occurrences 2015-10-03 22:58:00 +02: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 Nacke
1dacce4e53 Merge pull request #856 from kinke/win64abi
Win64 ABI fix: return non-POD structs via sret.
2015-04-08 21:12:49 +02:00
Martin
66fd55afc1 SysV ABI: don't pass delegates partially in registers, partially in memory. 2015-03-15 14:18:12 +01:00
Martin
01e3e372fa Win64 ABI fix: return non-POD structs via sret.
And get rid of obsolete integer rewrites on Win64 and PPC.
2015-02-28 22:51:51 +01:00
Martin
8a3a51e599 SysV ABI: remove support for VALIDATE_AGAINST_OLD_LDC_VERSION. 2015-02-23 22:52:12 +01:00
Martin
dbe801ddff Refactor ABI rewrites. 2015-02-23 22:52:12 +01:00