summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't emit exceptional stackrestore cleanups around inalloca functionsReid Kleckner2015-10-081-14/+1
| | | | | | | | The backend restores the stack pointer after recovering from an exception. This is similar to r245879, but it doesn't try to use the normal cleanup mechanism, so hopefully it won't cause the same breakage. llvm-svn: 249640
* Support __builtin_ms_va_list.Charles Davis2015-09-171-1/+7
| | | | | | | | | | | | | | | | | | Summary: This change adds support for `__builtin_ms_va_list`, a GCC extension for variadic `ms_abi` functions. The existing `__builtin_va_list` support is inadequate for this because `va_list` is defined differently in the Win64 ABI vs. the System V/AMD64 ABI. Depends on D1622. Reviewers: rsmith, rnk, rjmccall CC: cfe-commits Differential Revision: http://reviews.llvm.org/D1623 llvm-svn: 247941
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-09-151-1/+2
| | | | | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479 and other bug caused in chrome. After this patch got reverted because of ScalarEvolution bug (D12719) Merged after John McCall big patch (Added Address). http://reviews.llvm.org/D11859 http://reviews.llvm.org/D12865 llvm-svn: 247646
* Record function attribute "stackrealign" instead of using backend optionAkira Hatanaka2015-09-111-2/+2
| | | | | | | | | | | | -force-align-stack. Also, make changes to the driver so that -mno-stack-realign is no longer an option exposed to the end-user that disallows stack realignment in the backend. Differential Revision: http://reviews.llvm.org/D11815 llvm-svn: 247451
* [MS ABI] Make member pointers return true for isIncompleteTypeDavid Majnemer2015-09-101-2/+2
| | | | | | | The type of a member pointer is incomplete if it has no inheritance model. This lets us reuse more general logic already embedded in clang. llvm-svn: 247346
* Revert "Generating assumption loads of vptr after ctor call (fixed)"Piotr Padlewski2015-09-101-2/+1
| | | | | | | | It seems that there is small bug, and we can't generate assume loads when some virtual functions have internal visibiliy This reverts commit 982bb7d966947812d216489b3c519c9825cacbf2. llvm-svn: 247332
* Don't crash when emitting a block under returns_nonnull.John McCall2015-09-101-2/+2
| | | | | | rdar://22071955 llvm-svn: 247228
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-09-091-1/+2
| | | | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. After this patch got reverted because of ScalarEvolution bug (D12719) Merged after John McCall big patch (Added Address). http://reviews.llvm.org/D11859 llvm-svn: 247199
* [MS ABI] Don't crash on references to pointers to members in argsDavid Majnemer2015-09-091-2/+2
| | | | | | | | | | | | | We know that a reference can always be dereferenced. However, we don't always know the number of bytes if the reference's pointee type is incomplete. This case was correctly handled but we didn't consider the case where the type is complete but we cannot calculate its size for ABI specific reasons. In this specific case, a member pointer's size is available only under certain conditions. This fixes PR24703. llvm-svn: 247188
* findDominatingStoreToReturn in CGCall.cpp didn't check if a candidate storeJakub Kuderski2015-09-081-11/+14
| | | | | | | | | | | | | | instruction used the ReturnValue as pointer operand or value operand. This led to wrong code gen - in later stages (load-store elision code) the found store and its operand would be erased, causing ReturnValue to become a <badref>. The patch adds a check that makes sure that ReturnValue is a pointer operand of store instruction. Regression test is also added. This fixes PR24386. Differential Revision: http://reviews.llvm.org/D12400 llvm-svn: 247003
* Compute and preserve alignment more faithfully in IR-generation.John McCall2015-09-081-323/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. llvm-svn: 246985
* Migrate the target attribute parsing code to returning an instanceEric Christopher2015-09-021-11/+11
| | | | | | | | every time it's called rather than attempting to cache the result. It's unlikely to be called frequently and the overhead of using it in the first place is already factored out. llvm-svn: 246706
* Migrate the target attribute parsing code into an extension off ofEric Christopher2015-09-021-29/+8
| | | | | | | | | | the main attribute and cache the results so we don't have to parse a single attribute more than once. This reapplies r246596 with a fix for an uninitialized class member, and a couple of cleanups and formatting changes. llvm-svn: 246610
* Revert "Migrate the target attribute parsing code into an extension off of"Eric Christopher2015-09-011-8/+29
| | | | | | | | This is failing in release mode. Revert while I figure out what's happening. This reverts commit r246596. llvm-svn: 246598
* Migrate the target attribute parsing code into an extension off ofEric Christopher2015-09-011-29/+8
| | | | | | | the main attribute and cache the results so we don't have to parse a single attribute more than once. llvm-svn: 246596
* Use hasAttr, not getAttr if we're just checking for presence.Eric Christopher2015-09-011-1/+1
| | | | llvm-svn: 246595
* Revert "Pull the target attribute parsing out of CGCall and onto TargetInfo."Eric Christopher2015-08-311-9/+35
| | | | | | This reverts commit r246468 while we figure out what to do about Basic and AST. llvm-svn: 246508
* Pull the target attribute parsing out of CGCall and onto TargetInfo.Eric Christopher2015-08-311-35/+9
| | | | | | | | | Also: - Add a typedef to make working with the result easier. - Update callers to use the new function. - Make initFeatureMap out of line. llvm-svn: 246468
* Revert r246214 and r246213Steven Wu2015-08-281-2/+1
| | | | | | These two commits causes llvm LTO bootstrap to hang in ScalarEvolution. llvm-svn: 246282
* Merge the two feature map setting functions into a single functionEric Christopher2015-08-281-2/+1
| | | | | | and replace all callers. llvm-svn: 246259
* Use an explicit assignment.Eric Christopher2015-08-271-2/+2
| | | | llvm-svn: 246225
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-08-271-1/+2
| | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. http://reviews.llvm.org/D11859 llvm-svn: 246213
* Target attribute syntax compatibility fix - gcc uses no- rather than mno-.Eric Christopher2015-08-271-1/+1
| | | | llvm-svn: 246197
* Rewrite the code generation handling for function feature and cpu attributes.Eric Christopher2015-08-271-62/+70
| | | | | | | | | | | | | | | | | | | | A couple of changes here: a) Do less work in the case where we don't have a target attribute on the function. We've already canonicalized the attributes for the function - no need to do more work. b) Use the newer canonicalized feature adding functions from TargetInfo to do the work when we do have a target attribute. This enables us to diagnose some warnings in the case of conflicting written attributes (only ppc does this today) and also make sure to get all of the features for a cpu that's listed rather than just change the cpu. Updated all testcases accordingly and added a new testcase to verify that we'll error out on ppc if we have some incompatible options using the existing diagnosis framework there. llvm-svn: 246195
* Revert r245879. Speculative, might have caused crbug.com/524604Nico Weber2015-08-251-1/+15
| | | | llvm-svn: 245965
* [MS ABI] Don't emit stackrestore in cleanupsDavid Majnemer2015-08-241-15/+1
| | | | | | The stackrestore intrinsic isn't meaningful inside of a cleanup funclet. llvm-svn: 245879
* Revert "Generating assumption loads of vptr after ctor call (fixed)"Piotr Padlewski2015-08-211-2/+1
| | | | | | | | Reverting because of 245721 This reverts commit 552658e2b60543c928030b09cc9b5dfcb40c3f28. llvm-svn: 245727
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-08-211-1/+2
| | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. http://reviews.llvm.org/D11859 llvm-svn: 245721
* Properly provide alignment of 'byval' arguments down to llvm.James Y Knight2015-08-211-3/+18
| | | | | | | | | This is important in the case that the LLVM-inferred llvm-struct alignment is not the same as the clang-known C-struct alignment. Differential Revision: http://reviews.llvm.org/D12243 llvm-svn: 245719
* Devirtualize EHScopeStack::Cleanup's dtor because it's never destroyed ↵David Blaikie2015-08-181-1/+1
| | | | | | polymorphically llvm-svn: 245378
* Revert "Generating assumption loads of vptr after ctor call (fixed)"Justin Bogner2015-08-181-2/+1
| | | | | | | | | | | Bootstrap bots were failing: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/6382/ http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/2969 This reverts r245264. llvm-svn: 245267
* Generating assumption loads of vptr after ctor call (fixed)Piotr Padlewski2015-08-181-1/+2
| | | | | | | | | | | | | | | Generating call assume(icmp %vtable, %global_vtable) after constructor call for devirtualization purposes. For more info go to: http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html Edit: Fixed version because of PR24479. http://reviews.llvm.org/D11859 llvm-svn: 245264
* Untabify.Eric Christopher2015-08-111-12/+12
| | | | llvm-svn: 244695
* Use llvm::reverse to make a bunch of loops use foreach. NFC.Pete Cooper2015-07-301-4/+3
| | | | | | | | | | | | | | | | In llvm commit r243581, a reverse range adapter was added which allows us to change code such as for (auto I = Fields.rbegin(), E = Fields.rend(); I != E; ++I) { in to for (const FieldDecl *I : llvm::reverse(Fields)) This commit changes a few of the places in clang which are eligible to use this new adapter. llvm-svn: 243663
* Pass an iterator range to EmitCallArgsDavid Blaikie2015-07-211-9/+8
| | | | llvm-svn: 242824
* [MS Compat] Add support for __declspec(noalias)David Majnemer2015-07-201-1/+4
| | | | | | | The attribute '__declspec(noalias)' communicates that the function only accesses memory pointed to by its pointer-typed arguments. llvm-svn: 242728
* [AST] Cleanup ExprIterator.Benjamin Kramer2015-07-181-2/+2
| | | | | | | | - Make it a proper random access iterator with a little help from iterator_adaptor_base - Clean up users of magic dereferencing. The iterator should behave like an Expr **. - Make it an implementation detail of Stmt. This allows inlining of the assertions. llvm-svn: 242608
* Respect alignment when loading up a coerced function argumentUlrich Weigand2015-07-101-36/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | Code in CGCall.cpp that loads up function arguments that need to be coerced to a different type may in some cases ignore the fact that the source of the argument is not naturally aligned. This may cause incorrect code to be generated. In some places in CreateCoercedLoad, we already have setAlignment calls to address this, but I ran into one where it was missing, causing wrong code generation on SystemZ. However, in that location, we do not actually know what alignment of the source location we can rely on; the callers do not pass anything to this routine. This is already an issue in other places in CreateCoercedLoad; and the same problem exists for CreateCoercedStore. To avoid pessimising code, and to fix the FIXMEs already in place, this patch also adds an alignment argument to the CreateCoerced* routines and uses it instead of forcing an alignment of 1. The callers are changed to pass in the best information they have. This actually requires changes in a number of existing test cases since we now get better alignment in many places. Differential Revision: http://reviews.llvm.org/D11033 llvm-svn: 241898
* Update target attribute support for post-commit feedback.Eric Christopher2015-07-061-1/+1
| | | | | | | Use const auto rather than duplicating the type name and fix the error message when the attribute is applied to an incorrect entity. llvm-svn: 241526
* Handle arbitrary whitespace in the target attribute support.Eric Christopher2015-07-061-1/+5
| | | | | | | This allows us to deal a bit more gracefully with inclusions done by macros, token pasting, or just code layout/formatting. llvm-svn: 241525
* Attach attribute "trap-func-name" to call sites of llvm.trap and llvm.debugtrap.Akira Hatanaka2015-07-021-0/+2
| | | | | | | | | | | This is needed to use clang's command line option "-ftrap-function" for LTO and enable changing the trap function name on a per-call-site basis. rdar://problem/21225723 Differential Revision: http://reviews.llvm.org/D10831 llvm-svn: 241306
* [CodeGen] Use llvm::join to simplify string joining.Benjamin Kramer2015-07-021-8/+2
| | | | | | | While there replace stable_sort of std::string with just sort, stability is not necessary for "simple" value types. No functional change intended. llvm-svn: 241299
* Use a stable sort to guarantee target feature ordering in the IREric Christopher2015-07-011-0/+1
| | | | | | | in order to make testing somewhat more feasible. Has the advantage of making it easier to find target features as well. llvm-svn: 241134
* Fix a TODO dealing with canonicalizing attributes on functions byEric Christopher2015-07-011-9/+21
| | | | | | | | using a string map to canonicalize. Fix up a couple of testcases that needed changing since we are no longer simply appending features to the list, but all of their mask dependencies as well. llvm-svn: 241129
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Fix "the the" in comments/documentation/etc.Eric Christopher2015-06-191-1/+1
| | | | llvm-svn: 240110
* [CGCall] Fix potential invalid iterator decrement in ↵Alexey Samsonov2015-06-121-5/+4
| | | | | | | | | | | findDominatingStoreToReturnValue. If llvm.lifetime.end turns out to be the first instruction in the last basic block, we can decrement the iterator twice, going past rend. At the moment, this can never happen because llvm.lifetime.end always goes immediately after bitcast, but relying on this is very brittle. llvm-svn: 239638
* Handle fpmath= in the target attribute.Eric Christopher2015-06-121-0/+5
| | | | | | | | | | Right now we're ignoring the fpmath attribute since there's no backend support for a feature like this and to do so would require checking the validity of the strings and doing general subtarget feature parsing of valid and invalid features with the target attribute feature. llvm-svn: 239582
* Handle -mno-<feature> in target attribute strings by replacing theEric Christopher2015-06-121-2/+4
| | | | | | | -mno- with a -<feature> to match how we handle this in the rest of the frontend. llvm-svn: 239581
OpenPOWER on IntegriCloud