Commit graph

26 commits

Author SHA1 Message Date
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
Johan Engelen
3931fd7d24 Win64 ABI: do not (yet) return dynamic arrays via sret.
The druntime calling code in gen/arrays.cpp to e.g. `_d_newarrayU` is not yet able to handle sret.
2015-04-15 21:43:30 +02:00
Martin
626875d595 Win64 ABI: Return 80-bit real/ireal on x87 stack.
Just like DMD. Inline assembly in druntime/phobos depends on this.
Only relevant for MinGW-w64 as MSVC uses 64-bit real.
2015-03-16 00:16:16 +01:00
Martin
d24fc71a81 Win64 ABI: Treat dynamic arrays and delegates as structs.
I.e., pass them explicitly ByVal and return them via sret.
2015-03-16 00:10:36 +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
dbe801ddff Refactor ABI rewrites. 2015-02-23 22:52:12 +01:00
Martin
97dfd89127 SysV ABI: prevent varargs from being only partially passed in registers. 2015-02-23 22:52:11 +01:00
Martin
e7bfb78632 Refactor attributes system.
By introducing abstractions for attribute builder and set since they differ
greatly between LLVM 3.1-3.3.
2015-02-23 22:52:11 +01:00
Martin
5e3785159f Re-reverse parameter order for extern(D). 2015-02-23 22:52:11 +01:00
Martin
965b97c571 Refactor Win64 ABI.
I've decided to use a consistent scheme here - types are returned the same
way as they are passed as arguments. So cfloat as 64-bit struct in RAX,
cdouble/creal and 80-bit real/ireal as types > 64 bit via sret.

MS allows using the x87 stack, but there are no official guidelines as
they don't use x87 at all.
2015-02-23 22:52:11 +01:00
Martin
42c793d12b Use single ByVal ABI rewrite for both Win64 and PPC. 2015-02-23 22:52:11 +01:00
Martin
d8bdb77e47 Get rid of CfloatToInt ABI rewrite and extend CompositeToInt.
CompositeToInt now also accepts complex number pairs and all other types,
not just pointers to structs/static arrays.
2015-02-23 22:52:10 +01:00
Martin
9c9d0f66c7 Don't swap real and imaginary parts of complex numbers.
Rely on LLVM to select a sane order, don't use DMD as reference anymore.
2015-02-23 22:52:10 +01:00
Martin
c15e1a3e9f Win64 fix: don't attempt to rewrite composites of size 0 to integers 2015-02-23 22:52:10 +01:00
Martin
b8833b3d99 Win64 fix: pass 64-bit reals as doubles 2015-02-23 22:52:10 +01:00
Martin
9839cfb889 Experimental varargs fix 2015-02-23 22:52:10 +01:00
Martin
fc59c34da6 Fix and clean-up Win64 ABI 2015-02-23 22:52:10 +01:00
Martin
c64070c09e Win64 ABI hotfix 2014-10-21 23:02:36 +02:00
Martin
31e2c3eae9 Fix Win64 ABI wrt. passing structs > 64 bit 2014-10-21 21:52:23 +02:00
Alexey Prokhin
a6f358c59b Remove LINKintrisic 2014-07-10 18:10:46 +04:00
Alexey Prokhin
b819975c84 Eliminate the need for TypeFunction::funcdecl 2013-10-05 19:03:03 +04:00
kai
37558273c2 Remove SARRAYVALUE 2013-03-06 10:20:24 +01:00
kai
1e4a8fffc2 Remove DMDV1 and DMDV2. 2013-03-06 10:20:24 +01:00
David Nadlinger
3392f70a4e Move calling convention conversion into TargetABI.
The code is tightly coupled to TargetABI (the transformations
there only make sense knowing that the right CC is selected).
2013-02-26 00:20:45 +01:00
David Nadlinger
3662b06a88 Remove unused variable. 2013-02-13 00:07:52 +01:00
Martin
51b45675cc Support for Windows x64 ABI. 2013-02-10 22:08:35 +01:00