Anton Korobeynikov
eaf856db5d
Step forward with supporting of ARM homogenous aggregates:
...
- Handle unions
- Handle C++ classes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154664 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13 11:22:00 +00:00
David Blaikie
4e4d08403c
Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
...
The member variable is always "LangOpts" and the member function is always "getLangOpts".
Reviewed by Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 07:00:24 +00:00
Daniel Dunbar
edfac03024
IRgen/ABI/x86_64: Avoid passing small structs using byval sometimes.
...
- We do this when it is easy to determine that the backend will pass them on
the stack properly by itself.
Currently LLVM codegen is really bad in some cases with byval, for example, on
the test case here (which is derived from Sema code, which likes to pass
SourceLocations around)::
struct s47 { unsigned a; };
void f47(int,int,int,int,int,int,struct s47);
void test47(int a, struct s47 b) { f47(a, a, a, a, a, a, b); }
we used to emit code like this::
...
movl %esi, -8(%rbp)
movl -8(%rbp), %ecx
movl %ecx, (%rsp)
...
to handle moving the struct onto the stack, which is just appalling.
Now we generate::
movl %esi, (%rsp)
which seems better, no?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152462 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 01:03:58 +00:00
Aaron Ballman
6c60c8d746
Adding support for Microsoft's thiscall calling convention. Clang side of the patch.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151122 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-22 03:04:13 +00:00
John McCall
de5d3c7176
Whether an argument is required (in contrast with being an
...
optional argument passed through the variadic ellipsis)
potentially affects how we need to lower it. Propagate
this information down to the various getFunctionInfo(...)
overloads on CodeGenTypes. Furthermore, rename those
overloads to clarify their distinct purposes, and make
sure we're calling the right one in the right place.
This has a nice side-effect of making it easier to construct
a function type, since the 'variadic' bit is no longer
separable.
This shouldn't really change anything for our existing
platforms, with one minor exception --- we should now call
variadic ObjC methods with the ... in the "right place"
(see the test case), which I guess matters for anyone
running GNUStep on MIPS. Mostly it's just a substantial
clean-up.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150788 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-17 03:33:10 +00:00
Akira Hatanaka
a34e921165
Class objects passed by value follow the same rules as structure objects.
...
Double fields of by-value class objects should be passed in floating point
registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150200 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 19:54:16 +00:00
Akira Hatanaka
da54ff3062
Fix bugs in function MipsABIInfo::returnAggregateInRegs. Functions returning
...
class objects follow the same rules as those returning struct objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150196 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 18:49:26 +00:00
Akira Hatanaka
526cdfb2bf
Do not return records with non trivial destructors or copy constructors in
...
registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150035 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 01:31:22 +00:00
Chris Lattner
8b418685e9
simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149943 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-07 00:39:47 +00:00
Eli Friedman
55fc7e2b80
Add some ABI tweaks for i386-pc-win32 triple so that we return structs in an MSVC-compatible way. Patch by Joe Groff.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148992 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-25 22:46:34 +00:00
Akira Hatanaka
8f675e4b18
Make sure the integer type used to align the vaarg address is the same as the
...
type of pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148753 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 23:59:52 +00:00
Akira Hatanaka
a8536c086f
Ignore return type if its size is zero.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148744 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 23:18:57 +00:00
David Blaikie
3026348bd4
More dead code removal (using -Wunreachable-code)
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 21:50:17 +00:00
Akira Hatanaka
cc66254946
Take into account the pointer to an aggregate that is passed as a hidden
...
argument when Offset is initialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147986 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-12 01:10:09 +00:00
Akira Hatanaka
2afd23da0e
Call CodeGenTypes::ConvertType to get LLVM::Type*.
...
Remove function MipsABIInfo::GetFloatingPointTy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147985 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-12 00:52:17 +00:00
Akira Hatanaka
9db0a5e7e3
Remove switch/case statements and call GetFloatingPointTy() instead to get the
...
floating point type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147894 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10 23:30:49 +00:00
Akira Hatanaka
6d1080fd18
Flatten float complex arguments. N32/64 requires float complex arguments be
...
passed in floating point registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147892 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10 23:12:19 +00:00
Akira Hatanaka
9659d59ec3
Remove space.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147889 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10 22:44:52 +00:00
Chandler Carruth
b43550bf1b
Add support for the androideabi environment to our triple support, and
...
for the arm-linux-androideabi triple in particular.
Also use this to do a better job of selecting soft FP settings.
Patch by Evgeniy Stepanov.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147872 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10 19:47:42 +00:00
Joerg Sonnenberger
91ee4a7f36
Contrary to the other BSDs, NetBSD followed the ELF ABI for structure
...
passing on i386 and does not use registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10 16:53:17 +00:00
Akira Hatanaka
a33fd393d5
Insert padding before unaligned long double arguments.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147791 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-09 19:31:25 +00:00
Akira Hatanaka
f0cc2087b1
Add field PaddingType to ABIArgInfo which specifies the type of padding that
...
is inserted before the real argument. Padding is needed to ensure the backend
reads from or writes to the correct argument slots when the original alignment
of a byval structure is unavailable due to flattening.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147699 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 00:25:33 +00:00
Akira Hatanaka
c7ecc2e369
Have functions return structures smaller than 128-bit in registers if ABI
...
is either N32 or N64.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147520 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 03:34:42 +00:00
Tony Linthicum
9631939f82
Hexagon backend support
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 21:14:55 +00:00
Eli Friedman
68805fef77
Minor comment update.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145905 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-06 03:08:26 +00:00
Eli Friedman
ee1ad99f1c
When we're passing a vector with an illegal type through memory on x86-64, use byval so we're sure the backend does the right thing. Fixes va_arg with illegal vectors and an obscure ABI mismatch with __m64 vectors.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145652 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 00:11:43 +00:00
Eli Friedman
3ed7903d27
Don't use a varargs convention for calls unprototyped functions where one of the arguments is an AVX vector.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145574 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-01 04:53:19 +00:00
Tanya Lattner
ce275675d3
Correct the code generation for function arguments of vec3 types on x86_64 when they are greater than 128 bits. This was incorrectly coercing things like long3 into a double2.
...
Add test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145312 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 23:18:11 +00:00
Eli Friedman
5a1ac89b24
Finish r144971, which was an incomplete commit.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144972 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 04:01:36 +00:00
Eli Friedman
7e7ad3f8fa
Fix the meaning of an "empty" record for the case of a zero-length array. Use isEmptyRecord for arguments on x86-32; there are structs of size 0 which don't count as empty.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 03:47:20 +00:00
Eli Friedman
8d2fe42417
Make va_arg on x86-64 compute alignment the same way as argument passing.
...
Fixes <rdar://problem/10463281>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144966 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 02:44:19 +00:00
Eli Friedman
7b1fb81a51
A bunch of fixes to argument passing and va_arg on Darwin x86-32 for structures containing an SSE vector.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144963 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 02:12:09 +00:00
Eli Friedman
506d4e375a
Don't try to expand struct arguments containing holes on x86-32. From gcc struct layout tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 01:32:26 +00:00
Eli Friedman
bd4d3bcd2c
Simplify code for returning a struct for Darwin x86-32 ABI. Use a better type for a function returning a struct containing only a pointer. Handle the edge case of a struct containing only a float or double plus some dead padding instead of asserting.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144960 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 01:25:50 +00:00
Eli Friedman
5a4d35247f
Ignore empty unions in argument lowering on x86-32. From gcc struct layout tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144944 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 00:28:11 +00:00
Akira Hatanaka
b49d5a6606
Use a single integer type for a sub-doubleword part of a byval structure.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 23:31:00 +00:00
Jan Wen Voung
90306934bc
Do not add "byval" attribute to records with non-trivial copy constructors
...
and destructors in the DefaultABIInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143601 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 00:59:44 +00:00
Akira Hatanaka
b551dd31f6
Set MinABIStackAlignInBytes to 8 if ABI is N32/64.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143597 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 00:05:50 +00:00
Akira Hatanaka
d5a257f39b
Convert the type of a structure passed by value if it has double precision
...
fields in order to ease handling of such structures in backend.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143596 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 23:54:49 +00:00
Akira Hatanaka
c0e3b66534
Return function results whose size is smaller than 128-bits in registers if ABI
...
is N32/64.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143589 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 23:14:57 +00:00
Bob Wilson
3b694fab31
Check for homogeneous aggregate return values with ARM's AAPCS-VFP ABI.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143530 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 04:51:36 +00:00
Dan Gohman
0986eb5c59
Remove the SystemZ backend.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142879 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 23:48:52 +00:00
Peter Collingbourne
2f7aa998c0
TCE target: conversion of OpenCL reqd_work_group_size attr to metadata
...
Patch by Pekka Jääskeläinen!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141865 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 16:24:41 +00:00
Richard Smith
a6b8b2c096
Constant expression evaluation refactoring:
...
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
behaviour.
- Factor out evaluation of bitfield bit widths.
- Fix a few places which would evaluate an expression twice: once to determine
whether it is a constant expression, then again to get the value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141561 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 18:28:20 +00:00
Ted Kremenek
0628b724ff
Free 'TheTargetCodeGenInfo' in the class CodeGenModule. This looks like an obvious memory leak that was reported from LLDB devs. The comment indicates the leak is deliberate, but I have no idea why this needs to be so. Please comment/revert if you know otherwise.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141479 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 05:28:26 +00:00
Peter Collingbourne
744d90bfe2
CUDA: set proper calling conventions for PTX
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141296 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 16:49:54 +00:00
Justin Holewinski
818eafb6ac
PTX: Set proper calling conventions for PTX in OpenCL mode.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141193 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-05 17:58:44 +00:00
David Blaikie
eb2d1f1c88
Removing a bunch of dead returns/breaks after llvm_unreachables.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 20:26:49 +00:00
David Blaikie
b219cfc4d7
Switch assert(0/false) llvm_unreachable.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 05:06:16 +00:00
John McCall
01f151e0ff
ANSI C requires that a call to an unprototyped function type succeed
...
if the definition has a non-variadic prototype with compatible
parameters. Therefore, the default rule for such calls must be to
use a non-variadic convention. Achieve this by casting the callee to
the function type with which it is required to be compatible, unless
the target specifically opts out and insists that unprototyped calls
should use the variadic rules. The only case of that I'm aware of is
the x86-64 convention, which passes arguments the same way in both
cases but also sets a small amount of extra information; here we seek
to maintain compatibility with GCC, which does set this when calling
an unprototyped function.
Addresses PR10810 and PR10713.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140241 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 08:08:30 +00:00