summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Do not reuse the debug location of the return value's store if there is ↵Adrian Prantl2013-05-301-2/+4
| | | | | | | | autorelease code to be emitted between store and return instructions. This is analoguous to what we do for lexical scope cleanups. rdar://problem/13977888 llvm-svn: 182947
* Fix bad indentation.Jakob Stoklund Olesen2013-05-291-4/+4
| | | | llvm-svn: 182821
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-8/+4
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* Correctly emit certain implicit references to 'self' even withinJohn McCall2013-05-031-1/+1
| | | | | | | | | | | | | | | | | | a lambda. Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation functions. Fix that by generally improving getNonClosureContext to look through lambdas and captured statements but only report code contexts, which is generally what's wanted. Audit uses of CurFuncDecl and getNonClosureAncestor for correctness. Bug #2 is that lambdas weren't specially mapping 'self' when inside an ObjC method. Fix that by removing the requirement for that and using the normal EmitDeclRefLValue path in LoadObjCSelf. rdar://13800041 llvm-svn: 181000
* Ensure that the line table for functions with cleanups is sequential.Adrian Prantl2013-05-021-2/+5
| | | | | | | | | | | | | | | | If there is cleanup code, the cleanup code gets the debug location of the closing '}'. The subsequent ret IR-instruction does not get a debug location. The return _expression_ will get the debug location of the return statement. If the function contains only a single, simple return statement, the cleanup code may become the first breakpoint in the function. In this case we set the debug location for the cleanup code to the location of the return statement. rdar://problem/13442648 llvm-svn: 180932
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-161-5/+4
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* Fix uninitialized read of CalleeWithThisReturn.Manman Ren2013-03-261-1/+1
| | | | | | | | | Initialize CalleeWithThisReturn to 0 in the constructor. Also revert r170815 since checking CalleeWithThisReturn is faster. PR15598 llvm-svn: 178053
* Fix uninitialized read of CalleeWithThisReturn.Evgeniy Stepanov2013-03-261-1/+1
| | | | | | | | | | CalleeWithThisReturn can be left initialized if HasThisReturn() is false. This change reverses the order of checks in EmitFunctionEpilog such that CalleeWithThisReturn is only examined when it has a meaningful value. Found with MemorySanitizer. llvm-svn: 178015
* Under ARC, when we're passing the address of a strong variableJohn McCall2013-03-231-10/+81
| | | | | | | | | | | | to an out-parameter using the indirect-writeback conversion, and we copied the current value of the variable to the temporary, make sure that we register an intrinsic use of that value with the optimizer so that the value won't get released until we have a chance to retain it. rdar://13195034 llvm-svn: 177813
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-201-0/+25
| | | | | | | | | | | | | | For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. Updated from r177211. rdar://12818789 llvm-svn: 177541
* revert r177211 due to its potential issuesManman Ren2013-03-161-12/+0
| | | | llvm-svn: 177222
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-161-0/+12
| | | | | | | | | | | | | For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. rdar://12818789 llvm-svn: 177211
* Have these attriubtes set to 'true' or 'false'.Bill Wendling2013-03-131-52/+16
| | | | | | | | | The back-end cannot differentiate between functions that are from a .ll file and those generated from the front-end. We cannot then take the non-precense of these attributes as a "false" value. Have the front-end explicitly set the value to 'true' or 'false' depending upon what is actually set. llvm-svn: 176985
* Fix indirect byval passing of records in address spaced memory. Allocate ↵Guy Benyei2013-03-101-2/+8
| | | | | | memory on stack, and memcpy the actual value before the call. llvm-svn: 176786
* Change hasAggregateLLVMType, which conflates complex andJohn McCall2013-03-071-69/+55
| | | | | | | | | | | | | | | aggregate types in a profoundly wrong way that has to be worked around in every call site, to getEvaluationKind, which classifies and distinguishes between all of these cases. Also, normalize the API for loading and storing complexes. I'm working on a larger patch and wanted to pull these changes out, but it would have be annoying to detangle them from each other. llvm-svn: 176656
* Don't emit calls to virtual [[noreturn]] functions as noreturn; overrides of aRichard Smith2013-03-051-1/+4
| | | | | | | | [[noreturn]] function are not required to also be [[noreturn]]. We still emit calls to virtual __attribute__((noreturn)) functions as noreturn; unlike GCC, we do require overriders to also be noreturn for that attribute. llvm-svn: 176476
* Add more of the command line options as attribute flags.Bill Wendling2013-02-281-0/+60
| | | | | | These can be easily queried by the back-end. llvm-svn: 176304
* Use the actual ABI-determined C calling convention for runtimeJohn McCall2013-02-281-6/+79
| | | | | | | | | | | | | | | | | | | | | | calls and declarations. LLVM has a default CC determined by the target triple. This is not always the actual default CC for the ABI we've been asked to target, and so we sometimes find ourselves annotating all user functions with an explicit calling convention. Since these calling conventions usually agree for the simple set of argument types passed to most runtime functions, using the LLVM-default CC in principle has no effect. However, the LLVM optimizer goes into histrionics if it sees this kind of formal CC mismatch, since it has no concept of CC compatibility. Therefore, if this module happens to define the "runtime" function, or got LTO'ed with such a definition, we can miscompile; so it's quite important to get this right. Defining runtime functions locally is quite common in embedded applications. llvm-svn: 176286
* Reapply r176133 with testcase fixes.Bill Wendling2013-02-271-13/+0
| | | | llvm-svn: 176145
* Temporarily revert r176133 until testcases are modified.Bill Wendling2013-02-261-0/+13
| | | | llvm-svn: 176137
* Don't set the -target-cpu and -target-features attributes just now.Bill Wendling2013-02-261-13/+0
| | | | | | | This is causing some problems with some of the builders. It's non-trivial to reset the target's features. llvm-svn: 176133
* Revert "Add more attributes from the command line to functions."Anna Zaks2013-02-251-59/+1
| | | | | | | | This reverts commit 176009. The commit is a likely cause of several buildbot failures. llvm-svn: 176044
* Add more attributes from the command line to functions.Bill Wendling2013-02-251-1/+59
| | | | | | | This is an ongoing process. Any command line option which a back-end cares about should be added here. llvm-svn: 176009
* Revert r175912, "Add support for coldcc to clang" at John's request.Peter Collingbourne2013-02-231-4/+0
| | | | llvm-svn: 175936
* Make sure we apply attributes to correct places.Bill Wendling2013-02-221-13/+17
| | | | | | | Some attributes make sense only on the function or on the call site, but not both. Make this distinction here. llvm-svn: 175918
* Add support for coldcc to clangPeter Collingbourne2013-02-221-0/+4
| | | | llvm-svn: 175912
* Apply the 'nobuiltin' attribute to call sites when the user specifies ↵Bill Wendling2013-02-221-3/+8
| | | | | | `-fno-builtin' on the command line. llvm-svn: 175836
* Temporarily revert r175471 for more review.Bill Wendling2013-02-191-3/+0
| | | | llvm-svn: 175477
* Add a 'no-builtin' attribute if we do not want to simplify calls.Bill Wendling2013-02-181-0/+3
| | | | llvm-svn: 175471
* Add the 'target-cpu' and 'target-features' attributes to functions.Bill Wendling2013-02-151-0/+13
| | | | | | | The back-end will use these values to reconfigure code generation for different features. llvm-svn: 175308
* Revert accidental commit.Bill Wendling2013-02-141-13/+0
| | | | llvm-svn: 175143
* Pass the target options through to code generation.Bill Wendling2013-02-141-0/+13
| | | | | | | The code generation stuff is going to set attributes on the functions it generates. To do that it needs the target options. Pass them through. llvm-svn: 175141
* Semantic analysis and CodeGen support for C11's _Noreturn. This is modeled asRichard Smith2013-01-301-8/+6
| | | | | | an attribute for consistency with our other noreturn mechanisms. llvm-svn: 173898
* Use the AttributeSet instead of AttributeWithIndex.Bill Wendling2013-01-271-22/+13
| | | | | | | In the future, AttributeWithIndex won't be used anymore. Besides, it exposes the internals of the AttributeSet to outside users, which isn't goodness. llvm-svn: 173605
* Remove the last of uses that use the Attribute object as a collection of ↵Bill Wendling2013-01-231-4/+6
| | | | | | | | | attributes. Collections of attributes are handled via the AttributeSet class now. This finally frees us up to make significant changes to how attributes are structured. llvm-svn: 173229
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-171-1/+2
| | | | | | | | it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). llvm-svn: 172691
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-3/+3
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* Remove the Function::getFnAttributes method in favor of using the AttributeSetBill Wendling2012-12-301-1/+2
| | | | | | | | | directly. This is in preparation for removing the use of the 'Attribute' class as a collection of attributes. That will shift to the AttributeSet class instead. llvm-svn: 171254
* Add intel_ocl_bicc calling convention as a function attribute to clang. The ↵Guy Benyei2012-12-251-0/+4
| | | | | | calling convention is already implemented in LLVM. llvm-svn: 171056
* Rename llvm::Attributes to llvm::Attribute.Bill Wendling2012-12-201-40/+40
| | | | llvm-svn: 170722
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-40/+40
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-40/+40
| | | | | | single attribute in the future. llvm-svn: 170500
* s/AttrListPtr/AttributeSet/g to better label what this class is going to be ↵Bill Wendling2012-12-071-3/+3
| | | | | | in the near future. llvm-svn: 169652
* Fix the required args count for variadic blocks.John McCall2012-12-071-12/+47
| | | | | | | | | | | | | | | | | We were emitting calls to blocks as if all arguments were required --- i.e. with signature (A,B,C,D,...) rather than (A,B,...). This patch fixes that and accounts for the implicit block-context argument as a required argument. In addition, this patch changes the function type under which we call unprototyped functions on platforms like x86-64 that guarantee compatibility of variadic functions with unprototyped function types; previously we would always call such functions under the LLVM type T (...)*, but now we will call them under the type T (A,B,C,D,...)*. This last change should have no material effect except for making the type conventions more explicit; it was a side-effect of the most convenient implementation. llvm-svn: 169588
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Merge function types in C.Rafael Espindola2012-11-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Among other differences, GCC accepts typedef int IA[]; typedef int A10[10]; static A10 *f(void); static IA *f(void); void g(void) { (void)sizeof(*f()); } but clang used to reject it with: invalid application of 'sizeof' to an incomplete type 'IA' (aka 'int []') The intention of c99's 6.2.7 seems to be that we should use the composite type and accept as gcc does. Doing the type merging required some extra fixes: * Use the type from the function type in initializations, even if an parameter is available. * Fix the merging of the noreturn attribute in function types. * Make CodeGen handle the fact that an parameter type can be different from the corresponding type in the function type. llvm-svn: 168895
* ABI: comments from Eli on r168820.Manman Ren2012-11-281-0/+2
| | | | | | rdar://12723368 llvm-svn: 168821
* ABI: modify CreateCoercedLoad and CreateCoercedStore to not use load or store ofManman Ren2012-11-281-12/+12
| | | | | | | | | | | | | | | the original parameter or return type. Since we do not accurately represent the data fields of a union, we should not directly load or store a union type. As an exmple, if we have i8,i8, i32, i32 as one field type and i32,i32 as another field type, the first field type will be chosen to represent the union. If we load with the union's type, the 3rd byte and the 4th byte will be skipped. rdar://12723368 llvm-svn: 168820
* objective-C arc: load of a __weak object happens via call toFariborz Jahanian2012-11-271-4/+12
| | | | | | | | | | | objc_loadWeak. This retains and autorelease the weakly-refereced object. This hidden autorelease sometimes makes __weak variable alive even after the weak reference is erased, because the object is still referenced by an autorelease pool. This patch overcomes this behavior by loading a weak object via call to objc_loadWeakRetained(), followng it by objc_release at appropriate place, thereby removing the hidden autorelease. // rdar://10849570 llvm-svn: 168740
* Update method calls to the new interface re r168354.Bill Wendling2012-11-201-1/+2
| | | | llvm-svn: 168355
OpenPOWER on IntegriCloud