summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGAtomic.cpp
Commit message (Collapse)AuthorAge
* Atomics: emit "cmpxchg weak" where possibleTim Northover2014-06-13
| | | | | | | | | | | | | | | | | | Most builtins date from before the "cmpxchg weak" was a gleam in the C++ committee's eye, so fortunately not much needs to change. But a few of them *do* acknowledge that failure is possible. For these, we'll emit the usual cartesian product of cmpxchg operations if we can't statically determine weakness. CodeGen can sort it out later if the function gets inlined. The only other non-trivial aspect of this is (I think) that we emit the scalar expression for "IsWeak" once, at the beginning, and propagate its value through the successive blocks. There's not much in it, but it's slightly more consistent with the existing handling of FailureOrder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210932 91177308-0d34-0410-b5e6-96231b3b80d8
* IR-change: cmpxchg operations now return { iN, i1 }.Tim Northover2014-06-13
| | | | | | | | This is a minimal fix for clang. I'll soon add support for generating weak variants when requested, but that's not really necessary for the LLVM change in isolation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210907 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209272 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix atomic libcall.Logan Chien2014-03-26
| | | | | | | | | This commit fixes a cast instruction assertion failure due to the incompatible type cast. This will only happen when the target requires atomic libcalls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204834 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: use symbolic enumerators for memory orderTim Northover2014-03-13
| | | | | | | It makes the code clearer and less error-prone to use our (already known) special values for the various memory order cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203838 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: make use of weaker failure orders on cmpxchg.Tim Northover2014-03-13
| | | | | | | | | | | | This makes Clang take advantage of the recent IR addition of a "failure" memory ordering requirement. As with the "success" ordering, we try to emit just a single version if the expression is constant, but fall back to runtime detection (to allow optimisation across function-call boundaries). rdar://problem/15996804 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203837 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: produce error when invalid ordering is passed to atomic builtinTim Northover2014-03-11
| | | | | | | | | This is a conservative check, because it's valid for the expression to be non-constant, and in cases like that we just don't know whether it's valid. rdar://problem/16242991 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203561 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for IR: add a second AtomicOrdering to cmpxchg insts.Tim Northover2014-03-11
| | | | | | rdar://problem/15996804 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203560 91177308-0d34-0410-b5e6-96231b3b80d8
* IRGen: __c11/__atomic compare-and-exchange should respect the standardDavid Majnemer2014-03-10
| | | | | | | | | | | | | | | Summary: 'Expected' should only be modified if the operation fails. This fixes PR18899. Reviewers: chandlerc, rsmith, rjmccall CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2922 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203493 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202639 91177308-0d34-0410-b5e6-96231b3b80d8
* Add CodeGenABITypes.h for use in LLDB.Mark Lacey2013-10-30
| | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193717 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occursNick Lewycky2013-10-02
| | | | | | | when scalars are loaded / undergo lvalue-to-rvalue conversion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191808 91177308-0d34-0410-b5e6-96231b3b80d8
* No functionality change. Reflow lines that could fit on one line. Break linesNick Lewycky2013-10-01
| | | | | | | that had 80-column violations. Remove spurious emacs mode markers on .cpp files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191797 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify atomic load/store IRGen.Eli Friedman2013-07-11
| | | | | | Also fixes a couple minor bugs along the way; see testcases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186049 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix style bug introduced in r183033.Ed Schouten2013-05-31
| | | | | | | | | I renamed the function at one point in time, but forgot to fix the layout of the arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183036 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for optimized (non-generic) atomic libcalls.Ed Schouten2013-05-31
| | | | | | | | | | | | | | | | | | For integer types of sizes 1, 2, 4 and 8, libcompiler-rt (and libgcc) provide atomic functions that pass parameters by value and return results directly. libgcc and libcompiler-rt only provide optimized libcalls for __atomic_fetch_*, as generic libcalls on non-integer types would make little sense. This means that we can finally make __atomic_fetch_* work on architectures for which we don't provide these operations as builtins (e.g. ARM). This should fix the dreaded "cannot compile this atomic library call yet" error that would pop up once every while. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183033 91177308-0d34-0410-b5e6-96231b3b80d8
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-16
| | | | | | Patch by Stephen Lin! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179638 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed #if 0 code that doesn't compiled if uncommented.Rafael Espindola2013-04-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179495 91177308-0d34-0410-b5e6-96231b3b80d8
* Promote atomic type sizes up to a power of two, capped byJohn McCall2013-03-07
| | | | | | | | MaxAtomicPromoteWidth. Fix a ton of terrible bugs with _Atomic types and (non-intrinsic-mediated) loads and stores thereto. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176658 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the atomics code into its own file.John McCall2013-03-07
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176657 91177308-0d34-0410-b5e6-96231b3b80d8