summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Handle functions with struct arguments or return types and the regparmRafael Espindola2012-07-311-20/+16
| | | | | | | | | | | | | | attribute. It is a variation of the x86_64 ABI: * A struct returned indirectly uses the first register argument to pass the pointer. * Floats, Doubles and structs containing only one of them are not passed in registers. * Other structs are split into registers if they fit on the remaining ones. Otherwise they are passed in memory. * When a struct doesn't fit it still consumes the registers. llvm-svn: 161022
* Don't crash *or* insert a bogus autorelease when emitting aJohn McCall2012-07-311-1/+2
| | | | | | this-adjustment thunk in ARC++. llvm-svn: 161014
* [Windows] Use thiscall as the default calling convention for class methods. ↵Timur Iskhodzhanov2012-07-121-6/+11
| | | | | | PR12785 llvm-svn: 160121
* Distinguish more carefully between free functions and C++ instance methodsJohn McCall2012-07-071-50/+96
| | | | | | | | in the ABI arrangement, and leave a hook behind so that we can easily tweak CCs on platforms that use different CCs by default for C++ instance methods. llvm-svn: 159894
* revert CodeGen support for the alloc_size attribute until we finish the ↵Nuno Lopes2012-06-221-19/+0
| | | | | | design of a more generic metadata node llvm-svn: 159016
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-8/+7
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* adjust to mainline llvm API change.Chris Lattner2012-05-281-2/+1
| | | | llvm-svn: 157557
* fix codegen support for alloc_size attribute for static C++ methodsNuno Lopes2012-05-251-2/+4
| | | | | | add test case for C++ codegen llvm-svn: 157500
* add CodeGen support for the alloc_size attributeNuno Lopes2012-05-251-0/+17
| | | | llvm-svn: 157483
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-8/+8
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Propagate alignment on lvalues through EmitLValueForField. PR12395.Eli Friedman2012-04-161-11/+10
| | | | llvm-svn: 154789
* Step forward with supporting of ARM homogenous aggregates:Anton Korobeynikov2012-04-131-33/+90
| | | | | | | - Handle unions - Handle C++ classes llvm-svn: 154664
* Revert r153613 as it's causing large compile-time regressions on the nightly ↵Chad Rosier2012-03-291-2/+1
| | | | | | testers. llvm-svn: 153660
* When we can't prove that the target of an aggregate copy isJohn McCall2012-03-281-1/+2
| | | | | | | a complete object, the memcpy needs to use the data size of the structure instead of its sizeof() value. Fixes PR12204. llvm-svn: 153613
* When "low alignment" is specified, then set the alignment of the aggregate'sBill Wendling2012-03-161-1/+3
| | | | | | | | | | store to 1. This allows code-gen to select a more appropriate alignment. If left to zero, an alignment greater than the alignment of the pointer may be selected, causing code-gen to use instructions which require an alignment greater than the pointer guarantees. <rdar://problem/11043589> llvm-svn: 152951
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-5/+5
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-126/+221
| | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 150788
* Teach clang to add metadata tags to calls and invokes in ObjC withDan Gohman2012-02-161-6/+29
| | | | | | | | | -fno-objc-arc-exceptions. This will allow the optimizer to perform optimizations which are only safe under that flag. This is a part of rdar://10803830. llvm-svn: 150644
* Fix function prolog codegen whe coerce-to type is a struct.Evgeniy Stepanov2012-02-101-9/+30
| | | | | | | | | | This changes function prolog in such a way as to avoid out-of-bounds stack store in the case when coerce-to type has a larger storage size than the real argument type. Fixes PR11905. llvm-svn: 150238
* When emitting an ARC epilogue that looks like a return of 'self',John McCall2012-01-291-0/+56
| | | | | | | | kill the retain from the return site. This has the workaround nature. It's badness all around. llvm-svn: 149193
* Get a little bit smarter about killing off the ReturnValue allocaJohn McCall2012-01-291-10/+45
| | | | | | | in the presence of straight-line cleanups. This is a simple but important case, particularly for ARC. llvm-svn: 149190
* use llvm:Attributes instead of unsignedKostya Serebryany2012-01-201-10/+10
| | | | llvm-svn: 148554
* Move the piece of code up that skips the padding argument. Without this change,Akira Hatanaka2012-01-091-4/+4
| | | | | | padding insertion will not work if the coerced type is not a structure. llvm-svn: 147786
* Add field PaddingType to ABIArgInfo which specifies the type of padding thatAkira Hatanaka2012-01-071-0/+16
| | | | | | | | 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. llvm-svn: 147699
* Switch LValue so that it exposes alignment in CharUnits. (No functional ↵Eli Friedman2011-12-031-2/+3
| | | | | | change.) llvm-svn: 145753
* Add a utility to get a RValue for a given LValue for an aggregate; switch a ↵Eli Friedman2011-12-031-4/+3
| | | | | | few places over to it. llvm-svn: 145747
* Add inreg attributes to reference arguments.Rafael Espindola2011-11-271-1/+2
| | | | llvm-svn: 145189
* Fix crash in calling convention code expanding an struct with a complex member.Eli Friedman2011-11-151-3/+9
| | | | llvm-svn: 144612
* Fix alignment on alloca's for parameters using ABIArgInfo::Expand. Eli Friedman2011-11-031-4/+5
| | | | llvm-svn: 143658
* In x86_64, when calling an Objective-C method that returns a _Complex long ↵Anders Carlsson2011-10-311-0/+11
| | | | | | double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil. llvm-svn: 143350
* Fix a typo that completely broke the expansion of complex arguments.Bob Wilson2011-10-221-1/+1
| | | | llvm-svn: 142734
* Add returns_twice to functions that are known to return twice. This implementsRafael Espindola2011-10-121-0/+2
| | | | | | the same behavior of gcc by keeping the attribute out of the function type. llvm-svn: 141803
* Propagate __attribute__((returns_twice)) from C to IL.Rafael Espindola2011-10-031-0/+3
| | | | llvm-svn: 141002
* Allow getting all source locations of selector identifiers in a ObjCMethodDecl.Argyrios Kyrtzidis2011-10-031-1/+1
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-1/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-4/+4
| | | | llvm-svn: 140367
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-4/+4
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Slight optimization enabled by the previous assert: John McCall2011-08-261-1/+3
| | | | | | emit all gl-value arguments as reference bindings. llvm-svn: 138655
* Assert that a call argument is a gl-value iff the parameter is a reference type.John McCall2011-08-261-0/+3
| | | | llvm-svn: 138639
* Track whether an AggValueSlot is potentially aliased, and do notJohn McCall2011-08-251-0/+1
| | | | | | | | | | emit call results into potentially aliased slots. This allows us to properly mark indirect return slots as noalias, at the cost of requiring an extra memcpy when assigning an aggregate call result into a l-value. It also brings us into compliance with the x86-64 ABI. llvm-svn: 138599
* 'pure' and 'const' functions should also be marked nounwind. MigrateEric Christopher2011-08-151-2/+7
| | | | | | | test over from llvm/test/FrontendC++ and update others to account for the change. llvm-svn: 137669
* Handle "homogeneous aggregates" as required by the ARM AAPCS-VFP ABI.Bob Wilson2011-08-031-48/+80
| | | | | | | | | | | | | A homogeneous aggregate is an aggregate data structure where after flattening any nesting there are 1 to 4 elements of the same base type that is either a float, double, or Neon vector. All Neon vectors of the same size, either 64 or 128 bits, are treated as equivalent for this purpose. When using the AAPCS-VFP ABI, check for homogeneous aggregates and pass them as arguments by expanding them into a sequence of their base types. This requires extending the existing support for expanded arguments to handle not only structs, but also constant arrays and complex types. llvm-svn: 136767
* Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon ↵Chris Lattner2011-07-231-2/+2
| | | | | | Mulder! llvm-svn: 135855
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-24/+24
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* fix rdar://9780211 - Clang crashes with an assertion failure building ↵Chris Lattner2011-07-201-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | WKView.mm from WebKit This is something of a hack, the problem is as follows: 1. we instantiate both copied of RetainPtr with the two different argument types (an id and protocol-qualified id). 2. We refer to the ctor of one of the instantiations when introducing global "x", this causes us to emit an llvm::Function for a prototype whose "this" has type "RetainPtr<id<bork> >*". 3. We refer to the ctor of the other instantiation when introducing global "y", however, because it *mangles to the same name as the other ctor* we just use a bitcasted version of the llvm::Function we previously emitted. 4. We emit deferred declarations, causing us to emit the body of the ctor, however the body we emit is for RetainPtr<id>, which expects its 'this' to have an IR type of "RetainPtr<id>*". Because of the mangling collision, we don't have this case, and explode. This is really some sort of weird AST invariant violation or something, but hey a bitcast makes the pain go away. llvm-svn: 135572
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-29/+29
| | | | llvm-svn: 135370
* Convert CallInst and InvokeInst APIs to use ArrayRef.Jay Foad2011-07-151-7/+11
| | | | llvm-svn: 135265
* protect some calls to ConvertType when a function info is under constructionChris Lattner2011-07-151-3/+3
| | | | | | | to prevent recursive compilation problems. This fixes a failure of CodeGen/decl.c on x86-32 targets that don't fill in the coerce-to type. llvm-svn: 135256
* Enhance the IR type lowering code to be much smarter about recursively loweringChris Lattner2011-07-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | types. Fore xample, we used to lower: struct bar { int a; }; struct foo { void (*FP)(struct bar); } G; to: %struct.foo = type { {}* } since the function pointer would cause recursive translation of bar and we didn't know if that would get us into trouble. We are now smart enough to know that it is fine, so we get this type instead: %struct.foo = type { void (i32)* } Codegen still needs to be prepared for uncooperative types at any place, which is why I let the maximally uncooperative code sit around for awhile to help shake out the bugs. llvm-svn: 135244
* PR10337 reminds me that calls return values, lets handle them justChris Lattner2011-07-131-3/+9
| | | | | | like arguments. Thanks PR10337! :) llvm-svn: 135030
OpenPOWER on IntegriCloud