Commit Graph

375 Commits

Author SHA1 Message Date
Reid Kleckner 2336f58e88 Win64: Use ConvertType instead of checking the MS inheritance
dependent-type-member-pointer.cpp is failing on a win64 bot because
-fms-extensions is not enabled.  Use ConvertType rather than relying on
the inheritance attributes.  It's less code, but probably slower.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207819 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-02 01:14:59 +00:00
Reid Kleckner e0526bf22e Win64: Pass member pointers larger than 8 bytes by reference
The Win64 ABI docs on MSDN say that arguments bigger than 8 bytes are
passed by reference.  Prior to this change, we were only applying this
logic to RecordType arguments.  This affects both the Itanium and
Microsoft C++ ABIs.

Reviewers: majnemer

Differential Revision: http://reviews.llvm.org/D3587

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207817 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-02 00:51:20 +00:00
James Molloy 5d0678781a [ARM64] Add a missed case label for arm64_be, and enable the aarch64-varargs test for arm64_be.
This ensures that r203917 (cpirker "AArch64_be varargs processing for ARM ABI") is ported to ARM64.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206961 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-23 10:26:08 +00:00
Bob Wilson c9b73d121f ARM64: Do not expand variadic HFA/HVA arguments with the Darwin ABI.
Unlike the standard AAPCS64 ABI, variadic arguments are always passed on the
stack with the Darwin ABI, and this was not being considered when deciding
whether to expand HFA/HVA arguments in a call. An HFA argument with a "float"
base type was being expanded into separate "float" arguments, each of which
was then extended to a double, resulting in a serious mismatch from what is
expected by the va_arg implementation. <rdar://problem/15777067>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206729 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 01:23:39 +00:00
Bob Wilson 201871de18 Fix a comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206728 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 01:23:36 +00:00
Tim Northover af2bcba81b ARM64: make sure the caller is expected to extend in AAPCS.
This is one of those DarwinPCS differences. It'd been caught in
arguments, but not return values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206594 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 13:46:08 +00:00
Tim Northover db2467f5db ARM64: make sure HFAs on the stack get properly aligned.
Another AAPCS bug, part of PR19432.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206580 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 10:47:44 +00:00
Tim Northover f5e1e58384 ARM64: remove holes from *all* HFAs on the stack.
My first attempt to make sure HFAs were contiguous was in the block dealing
with padding registers, which meant it only triggered on the first stack-based
HFA. This should extend it to the rest as well.

Another part of PR19432.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206456 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 10:20:38 +00:00
Eli Bendersky 258f1c3511 Replace push_back()s by initializer list for shorter and cleaner code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206304 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 17:19:26 +00:00
Eli Bendersky 57e9d5ea97 Add support for CUDA __launch_bounds__ attribute to CodeGen.
Sema does have a CUDALaunchBoundsAttr, but CodeGen was doing nothing with it.
This change translates CUDALaunchBoundsAttr to maxntidx and minctasm
metadata, which NVPTX then translates to the correct PTX directives.

Patch by Manjunath Kudlur.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206302 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 16:57:05 +00:00
Tim Northover 3b35ae684c ARM64: track alignment padding registers on AAPCS targets
This implements clause C.8 of the AAPCS in the front-end, so that Clang
accurately knows when the registers run out and it has to insert padding before
the stack objects begin.

PR19432.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206296 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 14:55:11 +00:00
Reid Kleckner 5d6c2aba33 inalloca: Pad the struct *after* inserting each arg
This ensures that the overall struct size will be a multiple of 4, as
required by the ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205981 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-10 19:09:43 +00:00
Tim Northover 7e0e8ef787 ARM64: initial clang support commit.
This adds Clang support for the ARM64 backend. There are definitely
still some rough edges, so please bring up any issues you see with
this patch.

As with the LLVM commit though, we think it'll be more useful for
merging with AArch64 from within the tree.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205100 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-29 15:09:45 +00:00
Christian Pirker 37a9afe9eb Add ARM big endian Target (armeb, thumbeb)
Reviewed at http://llvm-reviews.chandlerc.com/D3096



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205008 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-28 14:40:46 +00:00
Saleem Abdulrasool 1e57f17deb Use the new Windows environment for target detection
This follows the LLVM change to canonicalise the Windows target triple
spellings.  Rather than treating each Windows environment as a single entity,
the environments are now modelled properly as an environment.  This is a
mechanical change to convert the triple use to reflect that change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204978 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 22:50:18 +00:00
Aaron Ballman bbe3878c88 [C++11] Replacing CGFunctionInfo arg iterators with iterator_range arguments(). Updating all of the usages of the iterators with range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204068 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-17 18:10:01 +00:00
Christian Pirker 85de826b58 AArch64_be varargs processing for ARM ABI
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203917 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14 11:51:06 +00:00
Aaron Ballman 7191c6b061 [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with iterator_range bases(). Updating all of the usages of the iterators with range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203803 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 15:41:46 +00:00
Oliver Stannard 75c6158d63 ARM: Correct alignment of structs passed as byval pointer
When a struct has bitfields overlapping with other members
(as required by the AAPCS), clang uses a packed struct to
represent this. If such a struct is large enough for clang to
pass it as a byval pointer (>64 bytes), we need to set the
alignment of the argument to match the original type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203660 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 14:02:50 +00:00
Craig Topper f7bc497ad1 [C++11] Add 'override' keyword to virtual methods that override their base class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203643 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 06:41:41 +00:00
Aaron Ballman 8328f6462b [C++11] Replacing RecordDecl iterators field_begin() and field_end() with iterator_range fields(). Updating all of the usages of the iterators with range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203355 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08 20:12:42 +00:00
Robert Lytton 192b0eb99b correct consitency of XCore caps
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202711 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 13:45:29 +00:00
Christian Pirker ee2e36b515 Add AArch64 big endian Target (aarch64_be)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202151 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 13:51:00 +00:00
Reid Kleckner 5b7370af53 MS ABI: Return sret parameters when using inalloca
Previously the X86 backend would look for the sret attribute and handle
this for us.  inalloca takes that all away, so we have to do the return
ourselves now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202097 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 00:59:14 +00:00
Roman Divacky aa099482ff Implement getDwarfEHStackPointer() and initDwarfEHRegSizeTable() for sparcv9.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202059 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-24 18:46:27 +00:00
Oliver Stannard 52b628c7b9 AAPCS: Do not split structs after CPRC allocated on stack
According to the AAPCS, we can split structs between GPRs and the stack,
except for when an argument has already been allocated on the stack. This
can occur when a large number of floating-point arguments fill up the VFP
registers, and are alllocated on the stack before the general-purpose argument
registers are full.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201137 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-11 09:25:50 +00:00
Oliver Stannard b8a10f1a63 Fix AAPCS compliance for HFAs containing doubles and long doubles
An HFA is defined as a struct containing floating point values of the
same machine type. In the 32-bit ABI, double and long double have the
same machine type, so a struct with a mixture of these types must be an
HFA (assuming it meets the other criteria).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200971 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-07 11:25:57 +00:00
Reid Kleckner 279292b8f1 [ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objects
When a non-trivial parameter is present, clang now gathers up all the
parameters that lack inreg and puts them into a packed struct.  MSVC
always aligns each parameter to 4 bytes and no more, so this is a pretty
simple struct to lay out.

On win64, non-trivial records are passed indirectly.  Prior to this
change, clang was incorrectly using byval on win64.

I'm able to self-host a working clang with this change and additional
LLVM patches.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D2636

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200597 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-01 00:04:45 +00:00
Reid Kleckner e6a9903e83 [ms-cxxabi] Use x86_cdeclmethodcc for __cdecl methods on win32
This fixes PR15768, where the sret parameter and the 'this' parameter
are in the wrong order.

Instance methods compiled by MSVC never return records in registers,
they always return indirectly through an sret pointer.  That sret
pointer always comes after the 'this' parameter, for both __cdecl and
__thiscall methods.

Unfortunately, the same is true for other calling conventions, so we'll
have to change the overall approach here relatively soon.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D2664

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200587 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31 22:54:50 +00:00
Amara Emerson e1978b8025 [ARM] Fix AAPCS-VFP non-compliance when returning HFA from variadic functions.
Arguments and return values must always be marshalled as for the base
AAPCS when the callee is a variadic function.

Patch by Oliver Stannard!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200307 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-28 10:56:36 +00:00
Reid Kleckner 0ee11e11e0 Refactor ABI argument lowering a little
Currently it tracks the number of free registers, but soon it will track
stack offsets for inalloca lowering.

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199532 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-18 01:12:41 +00:00
Jakob Stoklund Olesen 6316508c39 SPARC passes non-trivial C++ objects indirectly like everybody else.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199037 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-12 06:54:56 +00:00
Aaron Ballman b9d5ec18ae Hosting a call to getAttr so that we don't call it multiple times for the same attribute. Also removes a hasAttr that's not required. No functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197675 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 13:16:35 +00:00
Aaron Ballman 97915e5a02 Replacing calls to getAttr with calls to hasAttr for clarity. No functional change intended -- this only replaces Boolean uses of getAttr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197648 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 02:39:40 +00:00
Joerg Sonnenberger e13e3bbf3d Support EABIHF environment on ARM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197406 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-16 19:16:04 +00:00
Joerg Sonnenberger afbb59c847 GNUEABIHF is the same as GNUEABI for anything not float/double related,
so use the same exception size as GNUEABI does.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197404 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-16 18:30:28 +00:00
Joerg Sonnenberger 28d70e0cc4 Replace use of Triple::getEnvironmentName with the simpler
Triple::getEnvironment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197181 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-12 21:29:27 +00:00
Alp Toker 2b01e1e26d Correct hyphenations in comments and assert messages
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196466 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 04:47:09 +00:00
Richard Sandiford 76aef21494 [SystemZ] Fix handling of pass-by-pointer arguments
I'd misunderstood getIndirect() to mean that the argument should be passed
as a pointer at the ABI level, with the ByVal argument choosing caller-copy
semantics over no-caller-copy (callee-copy-on-write) semantics.  But
getIndirect(x) actually means that x is passed by pointer at the IR
level but (at least on all other targets I looked at) directly at the
ABI level.  getIndirect(x, false) selects a pointer to a caller-made
copy, which is what SystemZ was aiming for.

This fixes a miscompilation of c-index-test.  Structure arguments were being
passed by pointer, but no copy was being made, so a write in the callee
stomped over a caller's local variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196370 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-04 09:59:57 +00:00
Justin Holewinski 539110ffae [NVPTX] Update ABI handling
For PTX, we want the target to handle struct returns directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195268 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-20 20:35:34 +00:00
Akira Hatanaka dda91e0c4b [mips] Partially revert r193640. Stack alignment should not be determined by
the floating point register mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194426 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-11 22:10:46 +00:00
Rui Ueyama 723ceadd23 Use StringRef::endswith_lower. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193788 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 19:12:53 +00:00
Mark Lacey 8b54999a83 Add CodeGenABITypes.h for use in LLDB.
CodeGenABITypes is a wrapper built on top of CodeGenModule that exposes
some of the functionality of CodeGenTypes (held by CodeGenModule),
specifically methods that determine the LLVM types appropriate for
function argument and return values.

I addition to CodeGenABITypes.h, CGFunctionInfo.h is introduced, and the
definitions of ABIArgInfo, RequiredArgs, and CGFunctionInfo are moved
into this new header from the private headers ABIInfo.h and CGCall.h.

Exposing this functionality is one part of making it possible for LLDB
to determine the actual ABI locations of function arguments and return
values, making it possible for it to determine this for any supported
target without hard-coding ABI knowledge in the LLDB code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193717 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 21:53:58 +00:00
Akira Hatanaka 550ed2077e [mips] Align the stack to 16-bytes for -mfp64.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193640 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 19:00:35 +00:00
Akira Hatanaka 7ebd953872 [mips] Use the distance between the current argument's starting address and
the previous argument's ending address to compute the type of the padding
argument.

No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193638 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29 18:41:15 +00:00
Peter Collingbourne b914e87377 Implement function type checker for the undefined behavior sanitizer.
This uses function prefix data to store function type information at the
function pointer.

Differential Revision: http://llvm-reviews.chandlerc.com/D1338

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193058 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-20 21:29:19 +00:00
Andy Gibbs ed9967eb7e Fixed "ArgSize may be used uninitialised" error when compiling with gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192570 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14 07:02:04 +00:00
Robert Lytton 645e6fd1ba XCore : Fix bug in XCoreABIInfo::EmitVAArg()
Incorrect handling of 'double' and 'long long int'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192436 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-11 10:29:34 +00:00
Sylvestre Ledru 9a6002a09b remove a dead assignment. The variables are set just right after. Found by scan-build http://buildd-clang.debian.net/scan-build/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192061 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-06 09:54:18 +00:00
Mark Lacey 2363072da2 Pass CGCXXABIs around directly.
In functions that only need to use the CGCXXABI member of a CodeGenTypes
class, pass that reference around directly rather than a reference to
a CodeGenTypes class.

This makes the actual dependence on CGCXXABI clear at the call sites.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192052 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-06 01:33:34 +00:00