Commit graph

28 commits

Author SHA1 Message Date
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
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
c19550ad39 Fix va_arg intrinsic. 2015-02-23 22:52:11 +01:00
Martin
aa38fe06ec Refactoring: move ABI-specific variadic stuff to TargetABI type. 2015-02-23 22:52:11 +01:00
Martin
f5592048e5 Get rid of obsolete TargetABI::newFunctionType() and doneWithFunctionType(). 2015-02-23 22:52:11 +01:00
Martin
9839cfb889 Experimental varargs fix 2015-02-23 22:52:10 +01:00
David Nadlinger
cb341586e3 First merge of 2.064 beta.
This corresponds to DMD commit a913ce4bc59a94a022a27e390fc841f4aededffb.

Doesn't build Phobos yet.
2013-10-29 19:21:15 +01:00
Alexey Prokhin
b819975c84 Eliminate the need for TypeFunction::funcdecl 2013-10-05 19:03:03 +04:00
David Nadlinger
5b5ad8e0f7 Add some no-op virtual destructors to silence GCC warning. 2013-06-12 20:16:05 +02:00
David Nadlinger
c7c1c25f15 DValue: struct->class.
This is in line with an incoming upstream change making all
polymorphic structs classes, and also matches common coding
conventions.
2013-06-07 03:20:39 +02:00
kai
72b04d6ef8 Fix LLVM 3.3 build.
llvm/CallingConv.h was moved to folder llvm/IR.
2013-02-28 06:56:18 +01:00
David Nadlinger
2d3de4a3d4 Fix ABI on Win32.
We can't simply use the C calling convention, as the D(MD)
ABI is callee-pop, and this is hardcoded in naked functions
with stack parameters.

The \1 "trick" is normally used to avoid prefixes added by
LLVM; on the 3.2 release, a patch is needed to make it work
for the @<n> stdcall suffixes as well.
2013-02-26 13:14:32 +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
0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
kai
14b48bdca4 Add some comments to ABI interface 2012-12-28 20:41:05 +01:00
kai
7ccd510c11 Add missing forward declaration 2012-12-25 16:47:37 +01:00
David Nadlinger
0efa499b22 Cleanup: Actually use forward-declared types. 2012-12-20 01:00:59 +01:00
David Nadlinger
9458911839 Added LLVM-style license headers to all our files. 2012-12-16 17:19:14 +01:00
Alexey Prokhin
629f13929e WIP: port to llvm 3.0 2011-10-25 15:43:39 +04:00
Frits van Bommel
541f3723cd Intrinsics shouldn't see struct padding, so use a special TargetABI for them
that removes it.
This unbreaks the `llvm_*_with_overflow` intrinsics.
2009-05-16 13:06:49 +02:00
Frits van Bommel
27d3ab4546 Some calling convention work for x86-64:
- Implement x86-64 extern(C), hopefully correctly.
 - Tried to be a bit smarter about extern(D) while I was there.

Interestingly, this code seems to be generating more efficient code than
gcc and llvm-gcc in some edge cases, like returning a `{ [7 x i8] }` loaded from
a stack slot from an extern(C) function. (gcc generates 7 1-byte loads, while
this code generates a 4-byte, a 2-byte and a 1-byte load)

I also added some changes to make sure structs being returned from functions or
passed in as parameters are stored in memory where the rest of the backend seems
to expect them to be. These should be removed when support for first-class
aggregates improves.
2009-03-06 16:00:47 +01:00
Tomas Lindquist Olsen
65ba1d4d88 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries. 2009-03-04 17:24:25 +01:00
Tomas Lindquist Olsen
5dbe3ee8e2 Abstracted more (most) ABI details out of the normal codegen. 2009-03-03 02:51:21 +01:00
Tomas Lindquist Olsen
61dfb11bc5 - Fixed x86-32 C ABI for complex number return values.
- Removed unused code from the ABI class.
2009-03-01 19:01:05 +01:00
Tomas Lindquist Olsen
024946219a Forgot new files that were supposed to be in last commit. 2009-02-26 14:13:27 +01:00