hanchenye-llvm-project/llvm
James Y Knight 19f6cce4e3 Add __atomic_* lowering to AtomicExpandPass.
(Recommit of r266002, with r266011, r266016, and not accidentally
including an extra unused/uninitialized element in LibcallRoutineNames)

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: 266115
2016-04-12 20:18:48 +00:00
..
bindings [OCaml] Expose the LLVM diagnostic handler 2016-04-10 13:55:53 +00:00
cmake [CMake] Make llvm_ExternalProject always call the build action 2016-04-08 22:46:04 +00:00
docs Add __atomic_* lowering to AtomicExpandPass. 2016-04-12 20:18:48 +00:00
examples [Kaleidoscope] Rename Error -> LogError in Chapters 2-5. 2016-03-25 17:41:26 +00:00
include Add __atomic_* lowering to AtomicExpandPass. 2016-04-12 20:18:48 +00:00
lib Add __atomic_* lowering to AtomicExpandPass. 2016-04-12 20:18:48 +00:00
projects
resources
test Add __atomic_* lowering to AtomicExpandPass. 2016-04-12 20:18:48 +00:00
tools Fix some display bugs in llvm-pdbdump. 2016-04-11 20:39:17 +00:00
unittests APInt: Add overload of isMask 2016-04-12 18:17:23 +00:00
utils Delete mergefunctions.clang.svn.patch 2016-04-12 19:44:40 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt Moving llvm-test-depends and test-depends into the Tests folder; NFC, this simply cleans up the generated solution so that these targets don't live in the root folder of the IDE. 2016-04-12 15:09:14 +00:00
CODE_OWNERS.TXT Update owners to reflect recent changes 2016-04-01 20:40:49 +00:00
CREDITS.TXT
LICENSE.TXT Update copyright year to 2016. 2016-03-30 22:41:06 +00:00
LLVMBuild.txt
README.txt
configure
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.