summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add nonnull in CodeGen for __attribute__((nonnull))Hal Finkel2014-07-111-0/+11
| | | | | | | | We now have an LLVM-level nonnull attribute that can be applied to function parameters, and we emit it for reference types (as of r209723), but did not emit it when an __attribute__((nonnull)) was provided. Now we will. llvm-svn: 212835
* MS ABI: "Fix" passing non-POD structs by value to variadic functionsReid Kleckner2014-07-081-20/+25
| | | | | | | | | | Of course, such code is horribly broken and will explode on impact. That said, ATL does it, and we have to support them, at least a little bit. Fixes PR20191. llvm-svn: 212508
* Add 'nonnull' parameter or return attribute when producing an llvm pointer ↵Nick Lewycky2014-05-281-0/+6
| | | | | | type in a function type where the C++ type is a reference. Update the tests. llvm-svn: 209723
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-211-35/+35
| | | | llvm-svn: 209272
* Implement the flatten attribute.Peter Collingbourne2014-05-201-0/+6
| | | | | | | | | | This is a GNU attribute that causes calls within the attributed function to be inlined where possible. It is implemented by giving such calls the alwaysinline attribute. Differential Revision: http://reviews.llvm.org/D3816 llvm-svn: 209217
* Implement the no_split_stack attribute.Peter Collingbourne2014-05-191-1/+2
| | | | | | | | | This is a GNU attribute that allows split stacks to be turned off on a per-function basis. Differential Revision: http://reviews.llvm.org/D3817 llvm-svn: 209167
* MS ABI: Use musttail for thunk IR generationReid Kleckner2014-05-151-1/+1
| | | | | | | | | | | This allows us to perfectly forward non-trivial arguments that use inalloca. We still can't forward non-trivial arguments through thunks when we have a covariant return type with a non-trivial adjustment. This would require emitting an extra copy, which is non-conforming anyway. llvm-svn: 208927
* MS ABI: Pass 'sret' as the second parameter of instance methodsReid Kleckner2014-05-091-13/+52
| | | | | | | | | | | | | | | | | Summary: MSVC always passes 'sret' after 'this', unlike GCC. This required changing a number of places in Clang that assumed the sret parameter was always first in LLVM IR. This fixes win64 MSVC ABI compatibility for methods returning structs. Reviewers: rsmith, majnemer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3618 llvm-svn: 208458
* Reapply r208417 (olista01 'ARM: HFAs must be passed in consecutive ↵James Molloy2014-05-091-8/+34
| | | | | | registers'). Bots are now pacified. llvm-svn: 208425
* Revert r208417 (olista01 'ARM: HFAs must be passed in consecutive ↵James Molloy2014-05-091-34/+8
| | | | | | registers'). This is a followon commit from r208413 which broke the LLVM bots. llvm-svn: 208422
* ARM: HFAs must be passed in consecutive registersOliver Stannard2014-05-091-8/+34
| | | | | | | This is the clang counterpart to 208413, which ensures that Homogeneous Floating-point Aggregates are passed in consecutive registers on ARM. llvm-svn: 208417
* When doing int<->ptr coercion for big-endian, calculate the shift amount ↵James Molloy2014-05-071-2/+3
| | | | | | | | | | | | | | | correctly. Previously we calculated the shift amount based upon DataLayout::getTypeAllocSizeInBits. This will only work for legal types - types such as i24 that are created as part of structs for bitfields will return "32" from that function. Change to using getTypeSizeInBits. It turns out that AArch64 didn't run across this problem because it always returned [1 x i64] as the type for a bitfield, whereas ARM64 returns i64 so goes down this (better, but wrong) codepath. llvm-svn: 208231
* MS ABI x64: Pass small objects with dtors but no copy ctors directlyReid Kleckner2014-05-031-5/+10
| | | | | | | | | | | | | | | Passing objects directly (in registers or memory) creates a second copy of the object in the callee. The callee always destroys its copy, but we also have to destroy any temporary created in the caller. In other words, copy elision of these kinds of objects is impossible. Objects larger than 8 bytes with non-trivial dtors and trivial copy ctors are still passed indirectly, and we can still elide copies of them. Fixes PR19640. llvm-svn: 207889
* MS ABI x64: Don't destroy arguments twice on x64Reid Kleckner2014-05-011-4/+11
| | | | | | | | We were destroying them in the callee, and then again in the caller. We should use an EH-only cleanup and disable it at the point of the call for win64, even though we don't use inalloca. llvm-svn: 207733
* Update Clang for LLVM split stack API changes in r205997Reid Kleckner2014-04-101-0/+2
| | | | | | Patch by Alex Crichton! llvm-svn: 205998
* Avoid crashing when failing to emit a thunkReid Kleckner2014-04-101-2/+8
| | | | | | | | If we crash, we raise a crash handler dialog, and that's really annoying. Even though we can't emit correct IR until we have musttail, don't crash. llvm-svn: 205948
* MS ABI: Use the proper type for inalloca argsDavid Majnemer2014-03-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The definition of a type later in a translation unit may change it's type from {}* to (%struct.foo*)*. Earlier function definitions may use the former while more recent definitions might use the later. This is fine until they interact with one another (like one calling the other). In these cases, a bitcast is needed because the inalloca must match the function call but the store to the lvalue which initializes the argument slot has to match the rvalue's type. This technique is along the same lines with what the other, non-inalloca, codepaths perform. This fixes PR19287. Reviewers: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3224 llvm-svn: 205217
* ObjC: allow targets to decide when to use stret for blocks.Tim Northover2014-03-291-0/+5
| | | | | | | This was originally part of the ARM64 patch, but seems semantically separate. llvm-svn: 205097
* [C++11] Replacing CGFunctionInfo arg iterators with iterator_range ↵Aaron Ballman2014-03-171-8/+6
| | | | | | arguments(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204068
* [C++11] Replacing CallArgList writeback iterators with iterator_range ↵Aaron Ballman2014-03-171-3/+2
| | | | | | writebacks(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions. llvm-svn: 204062
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-1/+1
| | | | | | class. llvm-svn: 203643
* [C++11] Update Clang for the change to LLVM's Use-Def chain iterators inChandler Carruth2014-03-091-1/+1
| | | | | | | | | r203364: what was use_iterator is now user_iterator, and there is a use_iterator for directly iterating over the uses. This also switches to use the range-based APIs where appropriate. llvm-svn: 203365
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-20/+8
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* [C++11] Replacing ObjCMethodDecl iterators param_begin() and param_end() ↵Aaron Ballman2014-03-071-3/+2
| | | | | | with iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203255
* [Modules] Update to reflect the move of CallSite into the IR library inChandler Carruth2014-03-041-1/+1
| | | | | | LLVM r202816. llvm-svn: 202817
* MS ABI: Return sret parameters when using inallocaReid Kleckner2014-02-251-2/+20
| | | | | | | | 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. llvm-svn: 202097
* Exposing the noduplicate attribute within Clang, which marks functions so ↵Aaron Ballman2014-02-221-0/+2
| | | | | | | | that the optimizer does not duplicate code. Patch thanks to Marcello Maggioni! llvm-svn: 201941
* Remove local type use in template.Reid Kleckner2014-02-011-1/+1
| | | | llvm-svn: 200598
* [ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objectsReid Kleckner2014-02-011-44/+306
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 200597
* [ms-cxxabi] Use x86_cdeclmethodcc for __cdecl methods on win32Reid Kleckner2014-01-311-22/+28
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 200587
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-8/+8
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-6/+6
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* CodeGen: Introduce CodeGenPGO::setCurrentRegionUnreachableJustin Bogner2014-01-131-1/+1
| | | | | | | | There are a number of places where we do PGO.setCurrentRegionCount(0) directly after an unconditional branch. Give this operation a name so that it's clearer why we're doing this. llvm-svn: 199138
* CodeGen: Initial instrumentation based PGO implementationJustin Bogner2014-01-061-0/+1
| | | | llvm-svn: 198640
* Implement the MSABI and SysVABI calling conventions for Objective-C method ↵Aaron Ballman2013-12-181-2/+9
| | | | | | declarations. This appears to be an omission from r189644. llvm-svn: 197584
* [ms-cxxabi] The 'most derived' ctor parameter usually comes lastReid Kleckner2013-12-171-4/+5
| | | | | | | | | | | | | | Unlike Itanium's VTTs, the 'most derived' boolean or bitfield is the last parameter for non-variadic constructors, rather than the second. For variadic constructors, the 'most derived' parameter comes after the 'this' parameter. This affects constructor calls and constructor decls in a variety of places. Reviewers: timurrrr Differential Revision: http://llvm-reviews.chandlerc.com/D2405 llvm-svn: 197518
* [ms-cxxabi] Construct and destroy call arguments in the correct orderReid Kleckner2013-12-041-9/+57
| | | | | | | | | | | | | | | | | | | Summary: MSVC destroys arguments in the callee from left to right. Because C++ objects have to be destroyed in the reverse order of construction, Clang has to construct arguments from right to left and destroy arguments from left to right. This patch fixes the ordering by reversing the order of evaluation of all call arguments under the MS C++ ABI. Fixes PR18035. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2275 llvm-svn: 196402
* Add CodeGenABITypes.h for use in LLDB.Mark Lacey2013-10-301-0/+1
| | | | | | | | | | | | | | | | | | 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. llvm-svn: 193717
* Make CodeGenTypes data members private.Mark Lacey2013-10-101-4/+6
| | | | | | No functionality differences. llvm-svn: 192390
* Use the CGCXXABI member on CodeGenTypes.Mark Lacey2013-10-021-2/+1
| | | | | | | | | | CodeGenTypes already has a reference to a CGCXXABI. Use this directly rather than going through CodeGenModule to get to the same information. This is consistent with other references to CGCXXABI in CodeGenTypes functions defined in CGCall.cpp. llvm-svn: 191854
* Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occursNick Lewycky2013-10-021-13/+17
| | | | | | when scalars are loaded / undergo lvalue-to-rvalue conversion. llvm-svn: 191808
* No functionality change. Reflow lines that could fit on one line. Break linesNick Lewycky2013-10-011-3/+5
| | | | | | that had 80-column violations. Remove spurious emacs mode markers on .cpp files. llvm-svn: 191797
* Fix constructor-related typos.Benjamin Kramer2013-09-091-1/+1
| | | | | | Noticed by Roman Divacky. llvm-svn: 190311
* Add ms_abi and sysv_abi attribute handling.Charles Davis2013-08-301-0/+2
| | | | | | Based on a patch by Benno Rice! llvm-svn: 189644
* Delete CC_Default and use the target default CC everywhereReid Kleckner2013-08-271-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Makes functions with implicit calling convention compatible with function types with a matching explicit calling convention. This fixes things like calls to qsort(), which has an explicit __cdecl attribute on the comparator in Windows headers. Clang will now infer the calling convention from the declarator. There are two cases when the CC must be adjusted during redeclaration: 1. When defining a non-inline static method. 2. When redeclaring a function with an implicit or mismatched convention. Fixes PR13457, and allows clang to compile CommandLine.cpp for the Microsoft C++ ABI. Excellent test cases provided by Alexander Zinenko! Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1231 llvm-svn: 189412
* Only add this attribute when it's set. If it's not there, the assumption is ↵Bill Wendling2013-08-221-15/+2
| | | | | | that it's off. llvm-svn: 189064
* Abstract out virtual calls and virtual function prologue code generation; ↵Timur Iskhodzhanov2013-08-211-2/+14
| | | | | | implement them for -cxx-abi microsoft llvm-svn: 188870
* Use function attributes to indicate if we don't want to realign the stack.Bill Wendling2013-08-011-0/+3
| | | | llvm-svn: 187617
* Use the new boolean to StringRef function to generate the proper StringRefs.Bill Wendling2013-07-261-6/+6
| | | | llvm-svn: 187251
* Replace the "NoFramePointerElimNonLeaf" target option with a function attribute.Bill Wendling2013-07-251-0/+12
| | | | llvm-svn: 187092
OpenPOWER on IntegriCloud