summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[OPENMP] Initial support for '#pragma omp for'."Rafael Espindola2014-06-171-1/+0
| | | | | | | | This reverts commit r211096. Looks like it broke the msvc build: SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template llvm-svn: 211113
* [OPENMP] Initial support for '#pragma omp for'.Alexey Bataev2014-06-171-0/+1
| | | | llvm-svn: 211096
* Adding a new #pragma for the vectorize and interleave optimization hints.Aaron Ballman2014-06-061-4/+10
| | | | | | Patch thanks to Tyler Nowicki! llvm-svn: 210330
* Add __builtin_operator_new and __builtin_operator_delete, which act like callsRichard Smith2014-06-031-1/+5
| | | | | | | to the normal non-placement ::operator new and ::operator delete, but allow optimizations like new-expressions and delete-expressions do. llvm-svn: 210137
* When emitting a multidimensional array new, emit the initializers for theRichard Smith2014-06-031-1/+2
| | | | | | | | | trailing elements as a single loop, rather than sometimes emitting a nest of several loops. This fixes a bug where CodeGen would sometimes try to emit an expression with the wrong type for the element being initialized. Plus various other minor cleanups to the IR produced for array new initialization. llvm-svn: 210079
* AArch64/ARM64: rename ARM64 components to AArch64Tim Northover2014-05-241-2/+2
| | | | | | This keeps Clang consistent with backend naming conventions. llvm-svn: 209579
* AArch64/ARM64: update Clang after AArch64 removal.Tim Northover2014-05-241-2/+0
| | | | | | | | | | | A few (mostly CodeGen) parts of Clang were tightly coupled to the AArch64 backend. Now that it's gone, they will not even compile. I've also deduplicated RUN lines in many of the AArch64 tests. This might improve "make check-all" time noticably: some of those NEON tests were monsters. llvm-svn: 209578
* This patch adds a helper class (CGLoopInfo) for marking memory instructions ↵Alexander Musman2014-05-221-0/+9
| | | | | | | | | | with llvm.mem.parallel_loop_access metadata. It also adds a simple initial version of codegen for pragma omp simd (it will change in the future to support all the clauses). Differential revision: http://reviews.llvm.org/D3644 llvm-svn: 209411
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-211-33/+37
| | | | llvm-svn: 209272
* Non-allocatable Global Named RegisterRenato Golin2014-05-191-0/+3
| | | | | | | | | | | | | This patch implements global named registers in Clang, lowering to the just created intrinsics in LLVM (@llvm.read/write_register). A new type of LValue had to be created (Register), which just adds support to carry the metadata node containing the name of the register. Two new methods to emit loads and stores interoperate with another to emit the named metadata node. No guarantees are being made and only non-allocatable global variable named registers are being supported. Local named register support is unchanged. llvm-svn: 209149
* Don't indent in namespaces.Rafael Espindola2014-05-091-40/+40
| | | | llvm-svn: 208384
* [OPENMP] Initial codegen for '#pragma omp parallel'Alexey Bataev2014-05-061-0/+3
| | | | llvm-svn: 208077
* CodeGen: Handle CapturedStmt in instrumentation based profilingJustin Bogner2014-04-151-0/+2
| | | | | | | | CapturedStmt was being ignored by instrumentation based profiling, and its counters attributed to the containing function. Instead, we need to treat this as a top level entity, like we do with blocks. llvm-svn: 206231
* Cleanup: Add default arguments to CodeGenFunction::StartFunction.Adrian Prantl2014-04-111-2/+2
| | | | | | Thanks dblaikie for the suggestion! llvm-svn: 206012
* Debug info: (Bugfix) Make sure artificial functions like _GLOBAL__I_aAdrian Prantl2014-04-101-0/+4
| | | | | | | | | | | | | | | | are not associated with any source lines. Previously, if the Location of a Decl was empty, EmitFunctionStart would just keep using CurLoc, which would sometimes be correct (e.g., thunks) but in other cases would just point to a hilariously random location. This patch fixes this by completely eliminating all uses of CurLoc from EmitFunctionStart and rather have clients explicitly pass in a SourceLocation for the function header and the function body. rdar://problem/14985269 llvm-svn: 205999
* ARM64: initial clang support commit.Tim Northover2014-03-291-0/+14
| | | | | | | | | | | This adds Clang support for the ARM64 backend. There are definitely still some rough edges, so please bring up any issues you see with this patch. As with the LLVM commit though, we think it'll be more useful for merging with AArch64 from within the tree. llvm-svn: 205100
* Proper handling of static local variables with address space qualifiers.Eli Bendersky2014-03-241-3/+3
| | | | | | | | Similar to the implementation for globals in r157167. Patch by Jingyue Wu. llvm-svn: 204677
* [Modules] Update to reflect ValueHandle moving to the IR library in LLVMChandler Carruth2014-03-041-1/+1
| | | | | | r202821. llvm-svn: 202822
* ARM & AArch64: use table for EmitCommonNeonBuiltinExprTim Northover2014-02-211-3/+10
| | | | | | | | | | This extends the intrinsic lookup table format slightly, and adds entries for use the shared ARM/AArch64 definitions. The benefit is currently smaller than for the SISD intrinsics (there's more custom code implementing this set), but a few lines are saved and there's scope for future expansion. llvm-svn: 201848
* AArch64: refactor table-driven NEON lookup.Tim Northover2014-02-211-0/+2
| | | | | | | | | | This extracts the table-driven intrinsic lookup phase into a separate function, to be used by EmitCommonNeonBuiltinExpr soon. It also simplifies the logic used in that lookup, since VectorCastArgN and ScalarArgN were actually identical. llvm-svn: 201847
* Change PGO instrumentation to compute counts in a separate AST traversal.Bob Wilson2014-02-171-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [IRGen]. Fixes a crash in using Objective-C array Fariborz Jahanian2014-02-141-2/+2
| | | | | | | | | properties by fixing shouldBindAsLValue to accept arrays (like record types) because we always manipulate them in memory. Patch suggested by John MaCall. // rdar://15610943 llvm-svn: 201428
* [ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objectsReid Kleckner2014-02-011-1/+12
| | | | | | | | | | | | | | | | | | | 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
* ARM & AArch64: move shared vld/vst intrinsics to common implementation.Tim Northover2014-01-311-1/+2
| | | | llvm-svn: 200526
* ARM & AArch64: extend shared NEON implementation to first block.Tim Northover2014-01-301-2/+1
| | | | | | | This extends the refactoring to the whole of the first block of trivial correspondences (as a fairly arbitrary boundary). llvm-svn: 200472
* ARM & AArch64: fully share NEON implementation of permutation intrinsicsTim Northover2014-01-301-0/+3
| | | | | | | As a starting point, this moves the CodeGen for NEON permutation instructions (vtrn, vzip, vuzp) into a new shared function. llvm-svn: 200471
* Revert "CodeGen: Simplify CodeGenFunction::EmitCaseStmt"Justin Bogner2014-01-211-0/+5
| | | | | | | | | I misunderstood the discussion on this. The complexity here is justified by the malloc overhead it saves. This reverts commit r199302. llvm-svn: 199700
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-3/+3
| | | | | | | | | | | | | | | | | 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: Simplify CodeGenFunction::EmitCaseStmtJustin Bogner2014-01-151-5/+0
| | | | | | | | | | | | | Way back in r129652 we tried to avoid emitting an empty block at -O0 for switch cases that did nothing but break. This led to a poor debugging experience as reported in PR9796, so we disabled the optimization for -O0 but left it in for higher optimization levels in r154420. Since the whole point of this was to improve -O0, it's silly to keep the complexity at all. llvm-svn: 199302
* Revert "Debug info: Ensure that the last stop point in a function is still ↵Adrian Prantl2014-01-071-1/+1
| | | | | | | | within" This reverts commit r198461. llvm-svn: 198714
* Revert "Debug info: Implement a cleaner version of r198461. For symmetry with"Adrian Prantl2014-01-071-1/+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/+1
| | | | | | | | | 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-4/+24
| | | | llvm-svn: 198640
* Debug info: Ensure that the last stop point in a function is still withinAdrian Prantl2014-01-031-1/+1
| | | | | | | | | the lexical block formed by the compound statement that is the function body. rdar://problem/15010825 llvm-svn: 198461
* [ms-cxxabi] The 'most derived' ctor parameter usually comes lastReid Kleckner2013-12-171-0/+2
| | | | | | | | | | | | | | 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-43/+53
| | | | | | | | | | | | | | | | | | | 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
* [-cxx-abi microsoft] Emit thunks for pointers to virtual member functionsHans Wennborg2013-11-151-0/+5
| | | | | | | | | | | | | | | | Instead of storing the vtable offset directly in the function pointer and doing a branch to check for virtualness at each call site, the MS ABI generates a thunk for calling the function at a specific vtable offset, and puts that in the function pointer. This patch adds support for emitting such thunks. However, it doesn't support pointers to virtual member functions that are variadic, have an incomplete aggregate return type or parameter, or are overriding a function in a virtual base class. Differential Revision: http://llvm-reviews.chandlerc.com/D2104 llvm-svn: 194827
* Implement aarch64 neon instruction class misc.Kevin Qin2013-11-141-0/+5
| | | | llvm-svn: 194657
* C++1y sized deallocation: if we have a use, but not a definition, of a sizedRichard Smith2013-11-051-1/+1
| | | | | | | | | | | | | deallocation function (and the corresponding unsized deallocation function has been declared), emit a weak discardable definition of the function that forwards to the corresponding unsized deallocation. This allows a C++ standard library implementation to provide both a sized and an unsized deallocation function, where the unsized one does not just call the sized one, for instance by putting both in the same object file within an archive. llvm-svn: 194055
* Implement function type checker for the undefined behavior sanitizer.Peter Collingbourne2013-10-201-0/+1
| | | | | | | | | This uses function prefix data to store function type information at the function pointer. Differential Revision: http://llvm-reviews.chandlerc.com/D1338 llvm-svn: 193058
* Do not emit undefined lsrh/ashr for NEON shiftsAmaury de la Vieuville2013-10-041-0/+2
| | | | | | | | These IR instructions are undefined when the amount is equal to operand size, but NEON right shifts support such shifts. Work around that by emitting a different IR in these cases. llvm-svn: 191953
* Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occursNick Lewycky2013-10-021-13/+20
| | | | | | when scalars are loaded / undergo lvalue-to-rvalue conversion. llvm-svn: 191808
* Implement conversion to function pointer for generic lambdas without captures.Faisal Vali2013-09-291-1/+1
| | | | | | | | | | | | | | | | The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator. This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM. A few minor changes: - per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation). - I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively. - Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming. Thanks! llvm-svn: 191634
* Emit an error when attempting to generate IR for SEH __tryReid Kleckner2013-09-161-0/+1
| | | | | | | Currently we silently omit the code in the try and finally bodies, which is pretty bad. This way we fail loudly. llvm-svn: 190809
* Revert r189649 because it was breaking sanitizer bots.Yunzhong Gao2013-08-301-2/+1
| | | | llvm-svn: 189660
* Fixing a bug where debug info for a local variable gets emitted at file scope.Yunzhong Gao2013-08-301-1/+2
| | | | | | | The patch was discussed in Phabricator. See: http://llvm-reviews.chandlerc.com/D1281 llvm-svn: 189649
* Revert "PR14569: Omit debug info for thunks"David Blaikie2013-08-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r189320. Alexey Samsonov and Dmitry Vyukov presented some arguments for keeping these around - though it still seems like those tasks could be solved by a tool just using the symbol table. In a very small number of cases, thunks may be inlined & debug info might be able to save profilers & similar tools from misclassifying those cases as part of the caller. The extra changes here plumb through the VarDecl for various cases to CodeGenFunction - this provides better fidelity through a few APIs but generally just causes the CGF::StartFunction to fallback to using the name of the IR function as the name in the debug info. The changes to debug-info-global-ctor-dtor.cpp seem like goodness. The two names that go missing (in favor of only emitting those names as linkage names) are names that can be demangled - emitting them only as the linkage name should encourage tools to do just that. Again, thanks to Dinesh Dwivedi for investigation/work on this issue. llvm-svn: 189421
* Simplify/clean up debug info suppression in CodeGenFunctionDavid Blaikie2013-08-261-8/+0
| | | | | | | | | | 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
* CodeGen: Unify two implementations of canDevirtualizeMemberFunctionCall.Benjamin Kramer2013-08-251-0/+6
| | | | | | | | | They were mostly copy&paste of each other, move it to CodeGenFunction. Of course the two implementations have diverged over time; the one in CGExprCXX seems to be the more modern one so I picked that one and moved it to CGClass which feels like a better home for it. No intended functionality change. llvm-svn: 189203
OpenPOWER on IntegriCloud