llvm-project/llvm/lib
James Y Knight b91d38c5fe Add __atomic_* lowering to AtomicExpandPass.
AtomicExpandPass can now lower atomic load, atomic store, atomicrmw, and
cmpxchg instructions to __atomic_* library calls, when the target
doesn't support atomics of a given size.

This is the first step towards moving all atomic lowering from clang
into llvm. When all is done, the behavior of __sync_* builtins,
__atomic_* builtins, and C11 atomics will be unified.

Previously LLVM would pass everything through to the ISelLowering
code. There, unsupported atomic instructions would turn into __sync_*
library calls. Because of that behavior, Clang currently avoids emitting
llvm IR atomic instructions when this would happen, and emits __atomic_*
library functions itself, in the frontend.

This change makes LLVM able to emit __atomic_* libcalls, and thus will
eventually allow clang to depend on LLVM to do the right thing.

It is advantageous to do the new lowering to atomic libcalls in
AtomicExpandPass, before ISel time, because it's important that all
atomic operations for a given size either lower to __atomic_*
libcalls (which may use locks), or native instructions which won't. No
mixing and matching.

At the moment, this code is enabled only for SPARC, as a
demonstration. The next commit will expand support to all of the other
targets.

Differential Revision: http://reviews.llvm.org/D18200

llvm-svn: 266002
2016-04-11 22:22:33 +00:00
..
Analysis This reverts commit r265913 and r265912 2016-04-11 15:26:18 +00:00
AsmParser [GCC] Attribute ifunc support in llvm 2016-04-07 12:32:19 +00:00
Bitcode [ThinLTO] BitcodeWriter still requires Analysis library 2016-04-11 14:59:07 +00:00
CodeGen Add __atomic_* lowering to AtomicExpandPass. 2016-04-11 22:22:33 +00:00
DebugInfo Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message 2016-04-06 22:14:09 +00:00
ExecutionEngine Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message 2016-04-06 22:14:09 +00:00
Fuzzer Remove redundant .c_str(), as suggested by PR25633 2016-04-11 20:35:17 +00:00
IR Support the Nodebug emission kind for DICompileUnits. 2016-04-08 22:43:03 +00:00
IRReader Remove autoconf support 2016-01-26 21:29:08 +00:00
LTO [ThinLTO] Move summary computation from BitcodeWriter to new pass 2016-04-11 13:58:45 +00:00
LibDriver Remove autoconf support 2016-01-26 21:29:08 +00:00
LineEditor Fix Clang-tidy modernize-deprecated-headers warnings in some files; other minor fixes. 2016-03-28 17:40:08 +00:00
Linker ValueMapper: Extract llvm::RemapFunction from IRMover.cpp, NFC 2016-04-08 19:26:32 +00:00
MC MCParser: diagnose missing directional labels more clearly. 2016-04-11 19:50:46 +00:00
Object Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message 2016-04-06 22:14:09 +00:00
ObjectYAML [lanai] Add Lanai backend. 2016-03-28 13:09:54 +00:00
Option Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
Passes [PM] Rename the CRTP mixin base classes for the new pass manager to 2016-03-11 10:33:22 +00:00
ProfileData Add code comment/NFC 2016-04-11 17:13:08 +00:00
Support Fix missing include on OpenBSD 2016-04-08 16:45:05 +00:00
TableGen [TableGen] Fix typos in comments. NFC 2016-02-26 06:50:27 +00:00
Target Add __atomic_* lowering to AtomicExpandPass. 2016-04-11 22:22:33 +00:00
Transforms Fix a couple of redundant conditional expressions (PR27283, PR28282) 2016-04-11 20:35:01 +00:00
CMakeLists.txt Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
LLVMBuild.txt Add LLVMBuild for ObjectYAML. 2016-03-01 21:29:33 +00:00