Refactor AtomicExpand::expandAtomicRMWToCmpXchg into a standalone function.
authorJF Bastien <jfb@google.com>
Mon, 3 Aug 2015 15:29:47 +0000 (15:29 +0000)
committerJF Bastien <jfb@google.com>
Mon, 3 Aug 2015 15:29:47 +0000 (15:29 +0000)
commitca0cc470467c24559e464452bb829aa6cc431162
tree0bbb3414e770dcd08ab25f89626d2dff6783fa02
parent9987cb60bac069f6d1af3fced71f8b6284ef87a1
Refactor AtomicExpand::expandAtomicRMWToCmpXchg into a standalone function.

Summary:
This is useful for PNaCl's `RewriteAtomics` pass. NaCl intrinsics don't exist for some of the more exotic RMW instructions, so by refactoring this function into its own, `RewriteAtomics` can share code rewriting those atomics with `AtomicExpand` while additionally saving a few cycles by generating the `cmpxchg` NaCl-specific intrinsic with the callback. Without this patch, `RewriteAtomics` would require two extra passes over functions, by first requiring use of the full `AtomicExpand` pass to just expand the leftover exotic RMWs and then running itself again to expand resulting `cmpxchg`s.

NFC

Reviewers: jfb

Subscribers: jfb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243880 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/AtomicExpandUtils.h [new file with mode: 0644]
lib/CodeGen/AtomicExpandPass.cpp