summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
Commit message (Collapse)AuthorAgeFilesLines
* LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall2011-06-251-5/+4
| | | | | | by removing the redundant type parameter. llvm-svn: 133860
* Automatic Reference Counting.John McCall2011-06-151-10/+264
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Per Chris's suggestion, simplify code using llvm::getOrEnforceKnownAlignment.Eli Friedman2011-06-151-36/+15
| | | | llvm-svn: 133095
* Fix a regression from r132957 involving complex integers. (Fixes failures ↵Eli Friedman2011-06-151-2/+6
| | | | | | on gcc-testsuite bot.) llvm-svn: 133069
* The LLVM IR representation of byval arguments has a rather strange property: ↵Eli Friedman2011-06-141-5/+44
| | | | | | | | | | if the alignment of an argument to a call is less than the specified byval alignment for that argument, there is no way to specify the alignment of the implied copy. Therefore, we must ensure that the alignment of the argument is at least the byval alignment. To do this, we have to mess with the alignment of relevant alloca's in some cases, and insert a copy that conceptually shouldn't be necessary in some cases. This patch tries relatively hard to avoid creating an extra copy if it can be avoided (see test3 in the included testcase), but it is not possible to avoid in some cases (like test2 in the included testcase). rdar://9483886 llvm-svn: 132957
* Skip extra copy from aggregate where it isn't necessary; ↵Eli Friedman2011-05-261-0/+13
| | | | | | | | rdar://problem/8139919 . This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0. Originally r130717, but was backed out due to an ObjC regression. llvm-svn: 132102
* Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor2011-05-201-2/+2
| | | | | | | | | | | | | Type::isUnsignedIntegerOrEnumerationType(), which are like Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also consider the underlying type of a C++0x scoped enumeration type. Audited all callers to the existing functions, switching those that need to also handle scoped enumeration types (e.g., those that deal with constant values) over to the new functions. Fixes PR9923 / <rdar://problem/9447851>. llvm-svn: 131735
* For calls returning first-class aggregates, store by element instead of ↵Eli Friedman2011-05-171-2/+25
| | | | | | creating aggregate stores in common cases. This is more friendly to fast-isel. llvm-svn: 131490
* More killing of std::vector.John McCall2011-05-151-38/+38
| | | | llvm-svn: 131374
* Revert r130717, which caused a regression (<rdar://problem/9402621>).Douglas Gregor2011-05-071-13/+0
| | | | llvm-svn: 131057
* Skip extra copy from aggregate where it isn't necessary; ↵Eli Friedman2011-05-021-0/+13
| | | | | | rdar://problem/8139919 . This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0. llvm-svn: 130717
* Switch CallArgList from an std::pair to a new CallArg struct (which will ↵Eli Friedman2011-05-021-10/+9
| | | | | | eventually gain more members). Working towards modifying call emission to avoid unnecessary copies. llvm-svn: 130700
* Implement ARM pcs attribute. Basically it's another way of calling ↵Anton Korobeynikov2011-04-141-0/+5
| | | | | | | | | | convention selection (AAPCS or AAPCS+VFP), similar to fastcall / stdcall / whatevercall seen on x86. In particular, all library functions should always be AAPCS regardless of floating point ABI used. llvm-svn: 129534
* PR8369: make __attribute((regparm(0))) work correctly. Original patch byEli Friedman2011-04-091-5/+8
| | | | | | pageexec@freemail.hu, tweaks by me. llvm-svn: 129206
* Add support for language-specific address spaces. On top of that,Peter Collingbourne2011-03-181-1/+2
| | | | | | | | | add support for the OpenCL __private, __local, __constant and __global address spaces, as well as the __read_only, _read_write and __write_only image access specifiers. Patch originally by ARM; language-specific address space support by myself. llvm-svn: 127915
* Instead of storing an ASTContext* in FunctionProtoTypes with computed ↵Sebastian Redl2011-03-131-1/+1
| | | | | | noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall. llvm-svn: 127568
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-1/+1
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* Use a slightly more semantic interface for emitting call arguments.John McCall2011-03-111-17/+23
| | | | llvm-svn: 127494
* lib/CodeGen/CGCall.cpp: Don't invoke multiple Builder.CreateBitCast() on ↵NAKAMURA Takumi2011-03-101-2/+4
| | | | | | Builder.CreateMemCpy. Or we would see sideeffect incompatibility among gcc and clang. llvm-svn: 127405
* Use the "undergoes default argument promotion" bit on parameters toJohn McCall2011-03-091-17/+38
| | | | | | | | | | simplify the logic of initializing function parameters so that we don't need both a variable declaration and a type in FunctionArgList. This also means that we need to propagate the CGFunctionInfo down in a lot of places rather than recalculating it from the FAL. There's more we can do to eliminate redundancy here, and I've left FIXMEs behind to do it. llvm-svn: 127314
* Encode argument numbering in debug info so that code generator can emit them ↵Devang Patel2011-03-031-8/+10
| | | | | | | | in order. This fixes few blocks.exp regressions. llvm-svn: 126960
* Revert "Add CC_Win64ThisCall and set it in the necessary places."Tilmann Scheller2011-03-021-21/+8
| | | | | | This reverts commit 126863. llvm-svn: 126886
* revert r126858.Devang Patel2011-03-021-10/+8
| | | | llvm-svn: 126874
* Add CC_Win64ThisCall and set it in the necessary places.Tilmann Scheller2011-03-021-8/+21
| | | | llvm-svn: 126863
* Encode argument numbering in debug info so that code generator can emit them ↵Devang Patel2011-03-021-8/+10
| | | | | | | | | | in order. This fixes few blocks.exp regressions. Reapply r126795 with a fix (one character change) for gdb testsuite regressions. llvm-svn: 126858
* Revert r126794.Devang Patel2011-03-021-10/+8
| | | | llvm-svn: 126848
* Encode argument numbering in debug info so that code generator can emit them ↵Devang Patel2011-03-011-8/+10
| | | | | | | | in order. This fixes few blocks.exp regressions. llvm-svn: 126795
* objc IRGen for Next runtime message API.Fariborz Jahanian2011-03-011-1/+2
| | | | | | | | | | The prototype for objc_msgSend() is technically variadic - `id objc_msgSend(id, SEL, ...)`. But all method calls should use a prototype that matches the method, not the prototype for objc_msgSend itself(). // rdar://9048030 llvm-svn: 126754
* Simplify test to check an aggregate argument that has non trivial ↵Devang Patel2011-02-161-1/+1
| | | | | | | | constructor or destructor. This patch rewrites r125142. llvm-svn: 125632
* Fix family-friendly-o, tsk tsk.Daniel Dunbar2011-02-101-1/+1
| | | | llvm-svn: 125293
* Driver/Frontend: Wire up -mregparm=.Daniel Dunbar2011-02-091-3/+3
| | | | llvm-svn: 125201
* If an aggregate argument is passed indirectly because it has non trivialDevang Patel2011-02-091-1/+1
| | | | | | | | destructor or copy constructor than let debug info know about it. Radar 8945514. llvm-svn: 125142
* Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall2011-02-081-1/+1
| | | | | | | | Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
* Replace calls to getTypeSize() and getTypeAlign() with their 'InChars' Ken Dyck2011-01-191-4/+5
| | | | | | counterparts where char units are needed. llvm-svn: 123805
* Simplify mem{cpy, move, set} creation with IRBuilder.Benjamin Kramer2010-12-301-8/+6
| | | | llvm-svn: 122634
* Fix Whitespace.Michael J. Spencer2010-10-191-60/+60
| | | | llvm-svn: 116798
* IRgen/ABI: Add support for realigning structures which are passed by indirectDaniel Dunbar2010-09-161-2/+22
| | | | | | reference. llvm-svn: 114114
* Add symantic support for the Pascal calling convention viaDawn Perchik2010-09-031-0/+4
| | | | | | | "__attribute((pascal))" or "__pascal" (and "_pascal" under -fborland-extensions). Support still needs to be added to llvm. llvm-svn: 112939
* Re-commit r112916 with an additional fix for the self-host failures.John McCall2010-09-031-0/+3
| | | | | | I've audited the remaining getFunctionInfo call sites. llvm-svn: 112936
* Revert r112916, it's breaking selfhost pretty badly.John McCall2010-09-031-3/+0
| | | | llvm-svn: 112925
* It's not safe to use the generic CXXMethodDecl overload of CGT::getFunctionInfoJohn McCall2010-09-031-0/+3
| | | | | | | to set up a destructor call, because ABIs can tweak these conventions. Fixes rdar://problem/8386802. llvm-svn: 112916
* Teach IR generation to return 'this' from constructors and destructorsJohn McCall2010-08-311-18/+28
| | | | | | under the ARM ABI. llvm-svn: 112588
* IRgen: Switch more MakeAddr() users to MakeAddrLValue; this time for calls ↵Daniel Dunbar2010-08-211-2/+1
| | | | | | which were previously not computing the qualifier list. In most cases, I don't think it matters, but I believe this is conservatively more correct / consistent. llvm-svn: 111717
* IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument andDaniel Dunbar2010-08-211-11/+23
| | | | | | | | update callers as best I can. - This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement. - Serious review appreciated. llvm-svn: 111707
* fix PR5179 and correctly fix PR5831 to not miscompile.Chris Lattner2010-07-301-9/+47
| | | | | | | | | | | | | | | | | | | | The X86-64 ABI code didn't handle the case when a struct would get classified and turn up as "NoClass INTEGER" for example. This is perfectly possible when the first slot is all padding (e.g. due to empty base classes). In this situation, the first 8-byte doesn't take a register at all, only the second 8-byte does. This fixes this by enhancing the x86-64 abi stuff to allow and handle this case, reverts the broken fix for PR5831, and enhances the target independent stuff to be able to handle an argument value in registers being accessed at an offset from the memory value. This is the last x86-64 calling convention related miscompile that I'm aware of. llvm-svn: 109848
* fix a builder, why didn't clang++ catch this?Chris Lattner2010-07-291-1/+2
| | | | llvm-svn: 109735
* Kill off the 'coerce' ABI passing form. Now 'direct' and 'extend' alwaysChris Lattner2010-07-291-151/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have a "coerce to" type which often matches the default lowering of Clang type to LLVM IR type, but the coerce case can be handled by making them not be the same. This simplifies things and fixes issues where X86-64 abi lowering would return coerce after making preferred types exactly match up. This caused us to compile: typedef float v4f32 __attribute__((__vector_size__(16))); v4f32 foo(v4f32 X) { return X+X; } into this code at -O0: define <4 x float> @foo(<4 x float> %X.coerce) nounwind { entry: %retval = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2] %coerce = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2] %X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] store <4 x float> %X.coerce, <4 x float>* %coerce %X = load <4 x float>* %coerce ; <<4 x float>> [#uses=1] store <4 x float> %X, <4 x float>* %X.addr %tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1] store <4 x float> %add, <4 x float>* %retval %0 = load <4 x float>* %retval ; <<4 x float>> [#uses=1] ret <4 x float> %0 } Now we get: define <4 x float> @foo(<4 x float> %X) nounwind { entry: %X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] store <4 x float> %X, <4 x float>* %X.addr %tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1] ret <4 x float> %add } This implements rdar://8248065 llvm-svn: 109733
* dissolve some more complexity: make the x86-64 abi lowering codeChris Lattner2010-07-291-22/+2
| | | | | | | compute its own preferred types instead of having CGT compute them then pass them (circuituously) down into ABIInfo. llvm-svn: 109726
* now that ABIInfo depends on CGT, it has trivial access to suchChris Lattner2010-07-291-2/+2
| | | | | | | things as TargetData, ASTContext, LLVMContext etc. Stop passing them through so many APIs. llvm-svn: 109723
* tidy upChris Lattner2010-07-281-8/+6
| | | | llvm-svn: 109699
OpenPOWER on IntegriCloud