summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Modules] Update to reflect the move of CallSite into the IR library inChandler Carruth2014-03-041-1/+1
| | | | | | LLVM r202816. llvm-svn: 202817
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-2/+2
| | | | llvm-svn: 202639
* Do not put instrumentation counters before phis in ObjC for-in loops.Bob Wilson2014-02-241-3/+3
| | | | | | | We still don't use the PGO to set branch weights for these loops, but at least this keeps the compiler from crashing. <rdar://problem/16137778> llvm-svn: 202002
* Change PGO instrumentation to compute counts in a separate AST traversal.Bob Wilson2014-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we made one traversal of the AST prior to codegen to assign counters to the ASTs and then propagated the count values during codegen. This patch now adds a separate AST traversal prior to codegen for the -fprofile-instr-use option to propagate the count values. The counts are then saved in a map from which they can be retrieved during codegen. This new approach has several advantages: 1. It gets rid of a lot of extra PGO-related code that had previously been added to codegen. 2. It fixes a serious bug. My original implementation (which was mailed to the list but never committed) used 3 counters for every loop. Justin improved it to move 2 of those counters into the less-frequently executed breaks and continues, but that turned out to produce wrong count values in some cases. The solution requires visiting a loop body before the condition so that the count for the condition properly includes the break and continue counts. Changing codegen to visit a loop body first would be a fairly invasive change, but with a separate AST traversal, it is easy to control the order of traversal. I've added a testcase (provided by Justin) to make sure this works correctly. 3. It improves the instrumentation overhead, reducing the number of counters for a loop from 3 to 1. We no longer need dedicated counters for breaks and continues, since we can just use the propagated count values when visiting breaks and continues. To make this work, I needed to make a change to the way we count case statements, going back to my original approach of not including the fall-through in the counter values. This was necessary because there isn't always an AST node that can be used to record the fall-through count. Now case statements are handled the same as default statements, with the fall-through paths branching over the counter increments. While I was at it, I also went back to using this approach for do-loops -- omitting the fall-through count into the loop body simplifies some of the calculations and make them behave the same as other loops. Whenever we start using this instrumentation for coverage, we'll need to add the fall-through counts into the counter values. llvm-svn: 201528
* [ms-cxxabi] Use x86_cdeclmethodcc for __cdecl methods on win32Reid Kleckner2014-01-311-12/+8
| | | | | | | | | | | | | | | | | | | 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
* Objective-C [IRGen]. Generator a tail call to objc_getProperty() in Fariborz Jahanian2014-01-301-1/+5
| | | | | | | synthesized getters for performance improvement. // rdar://15884113 llvm-svn: 200430
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-18/+15
| | | | | | | | | | | | | | | 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
* Re-applying r198699 after reverting r198461.Adrian Prantl2014-01-071-1/+2
| | | | | | | | Debug info: Implement a cleaner version of r198461. For symmetry with C and C++ don't emit an extra lexical scope for the compound statement that is the body of an Objective-C method. llvm-svn: 198715
* Revert "Debug info: Implement a cleaner version of r198461. For symmetry with"Adrian Prantl2014-01-071-2/+1
| | | | | | This reverts commit 198699 so we can get a cleaner patch. llvm-svn: 198713
* Debug info: Implement a cleaner version of r198461. For symmetry withAdrian Prantl2014-01-071-1/+2
| | | | | | | | | C and C++ don't emit an extra lexical scope for the compound statement that is the body of an Objective-C method. rdar://problem/15010825 llvm-svn: 198699
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* CodeGen: Initial instrumentation based PGO implementationJustin Bogner2014-01-061-1/+8
| | | | llvm-svn: 198640
* Remove a whole lot of unused variablesAlp Toker2013-11-271-1/+0
| | | | | | | There are about 30 removed in this patch, generated by a new FixIt I haven't got round to submitting yet. llvm-svn: 195814
* 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
* Fix build breakage, missed committing a chunk of a patch.Nick Lewycky2013-10-021-1/+1
| | | | llvm-svn: 191809
* Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occursNick Lewycky2013-10-021-6/+8
| | | | | | 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-4/+1
| | | | | | that had 80-column violations. Remove spurious emacs mode markers on .cpp files. llvm-svn: 191797
* Simplify/clean up debug info suppression in CodeGenFunctionDavid Blaikie2013-08-261-8/+2
| | | | | | | | | | CodeGenFunction is run on only one function - a new object is made for each new function. I would add an assertion/flag to this effect, but there's an exception: ObjC properties involve emitting helper functions that are all emitted by the same CodeGenFunction object, so such a check is not possible/correct. llvm-svn: 189277
* Correctly emit certain implicit references to 'self' even withinJohn McCall2013-05-031-2/+4
| | | | | | | | | | | | | | | | | | 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
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-161-1/+1
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* objc_autoreleasePoolPop() can throw if a -dealloc does.John McCall2013-04-161-1/+3
| | | | | | | | | | | | | Model it as throwing so that the exception can be caught. This is generally not expected to have significant code-size impact because the contents of the @autoreleasepool block are very likely to contain a call, very likely at the same cleanup level as the @autoreleasepool itself. rdar://13660038 llvm-svn: 179630
* Protect the values of array and dictionary literals from theJohn McCall2013-04-041-6/+33
| | | | | | | | | | ARC optimizer while they're held in local unsafe buffers. Based on a patch by Jesse Rusak! rdar://13573224 llvm-svn: 178721
* Add 178663 back.Rafael Espindola2013-04-031-2/+0
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-0/+2
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-2/+0
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Objective-C: Provide fixit hints when warningFariborz Jahanian2013-04-021-1/+2
| | | | | | | | about 'isa' ivar being explicitely accessed when base is a user class object reference. // rdar://13503456 llvm-svn: 178562
* Under ARC, when we're passing the address of a strong variableJohn McCall2013-03-231-0/+15
| | | | | | | | | | | | 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
* Tighten up the rules for precise lifetime and documentJohn McCall2013-03-131-8/+11
| | | | | | | | the requirements on the ARC optimizer. rdar://13407451 llvm-svn: 176924
* Change hasAggregateLLVMType, which conflates complex andJohn McCall2013-03-071-7/+14
| | | | | | | | | | | | | | | 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
* Remove temporary std::vectors that ca be replaced with ArrayRef's magic.Benjamin Kramer2013-03-071-11/+7
| | | | llvm-svn: 176653
* Use the actual ABI-determined C calling convention for runtimeJohn McCall2013-02-281-36/+28
| | | | | | | | | | | | | | | | | | | | | | 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
* In ARC, emit non-peepholed +1s within the full-expression insteadJohn McCall2013-02-121-17/+19
| | | | | | of immediately afterwards. llvm-svn: 174922
* Fixed another whitespace issue... *sigh*.Michael Gottesman2013-02-021-3/+3
| | | | llvm-svn: 174255
* Fixed whitespace.Michael Gottesman2013-02-021-1/+1
| | | | llvm-svn: 174254
* On platforms which do not support ARC natively, do not mark ↵Michael Gottesman2013-02-021-4/+6
| | | | | | | | | objc_retain/objc_release as "nonlazybind". rdar://13108298. rdar://13129783. llvm-svn: 174253
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-2/+2
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* Rename llvm::Attributes to llvm::Attribute.Bill Wendling2012-12-201-1/+1
| | | | llvm-svn: 170722
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-1/+1
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-1/+1
| | | | | | single attribute in the future. llvm-svn: 170500
* Remove obsolete FIXMEs.David Chisnall2012-12-181-2/+0
| | | | llvm-svn: 170425
* Inline hasAtomicCopyHelperAPI.Rafael Espindola2012-12-181-6/+2
| | | | llvm-svn: 170408
* Reapply r170344, this time without forgetting to commit the header changes.David Chisnall2012-12-171-4/+3
| | | | llvm-svn: 170354
* Revert "Added support for new property helpers (GNUstep runtime)."Benjamin Kramer2012-12-171-3/+4
| | | | | | This reverts commit r170344. Doesn't even compile. llvm-svn: 170351
* Added support for new property helpers (GNUstep runtime).David Chisnall2012-12-171-4/+3
| | | | llvm-svn: 170344
* Marking the objc_autoreleaseReturnValue and objc_retainAutoreleaseReturnValue Chad Rosier2012-12-121-3/+8
| | | | | | | | | | call sites as tail calls unconditionally. While it's theoretically true that this is just an optimization, it's an optimization that we very much want to happen even at -O0, or else ARC applications become substantially harder to debug. See r169796 for the llvm/fast-isel side of things. rdar://12553082 llvm-svn: 169996
* Don't crash synthesizing an ObjC property with an empty struct type. ↵Eli Friedman2012-10-261-0/+8
| | | | | | <rdar://problem/12547611>. llvm-svn: 166825
* At -O0, prefer objc_storeStrong with a null new value to theJohn McCall2012-10-171-4/+24
| | | | | | | | | | | combination of a load+objc_release; this is generally better for tools that try to track why values are retained and released. Also use objc_storeStrong when copying a block (again, only at -O0), which requires us to do a preliminary store of null in order to compensate for objc_storeStrong's assign semantics. llvm-svn: 166085
* Transform pattern:Alexey Samsonov2012-10-161-8/+6
| | | | | | | | | | | if (CGM.getModuleDebugInfo()) DebugInfo = CGM.getModuleDebugInfo() into a call: maybeInitializeDebugInfo(); This is a simplification for a possible future fix of PR13942. llvm-svn: 166019
* Un-revert r164907 and r164902 (+ follow-ups), 10.6 build fix to follow.Daniel Dunbar2012-10-151-7/+2
| | | | llvm-svn: 165988
OpenPOWER on IntegriCloud