[PATCH] D52234: [docs][AtomicExpandPass] Document the alternate lowering strategy for part-word atomicrmw/cmpxchg

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 30 01:26:55 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL347971: [docs][AtomicExpandPass] Document the alternate lowering strategy for part-word… (authored by asb, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52234?vs=166131&id=176050#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D52234/new/

https://reviews.llvm.org/D52234

Files:
  llvm/trunk/docs/Atomics.rst


Index: llvm/trunk/docs/Atomics.rst
===================================================================
--- llvm/trunk/docs/Atomics.rst
+++ llvm/trunk/docs/Atomics.rst
@@ -461,8 +461,24 @@
 * atomic rmw -> loop with cmpxchg or load-linked/store-conditional
   by overriding ``expandAtomicRMWInIR()``
 * expansion to __atomic_* libcalls for unsupported sizes.
-
-For an example of all of these, look at the ARM backend.
+* part-word atomicrmw/cmpxchg -> target-specific intrinsic by overriding
+  ``shouldExpandAtomicRMWInIR``, ``emitMaskedAtomicRMWIntrinsic``,
+  ``shouldExpandAtomicCmpXchgInIR``, and ``emitMaskedAtomicCmpXchgIntrinsic``.
+
+For an example of these look at the ARM (first five lowerings) or RISC-V (last
+lowering) backend.
+
+AtomicExpandPass supports two strategies for lowering atomicrmw/cmpxchg to
+load-linked/store-conditional (LL/SC) loops. The first expands the LL/SC loop
+in IR, calling target lowering hooks to emit intrinsics for the LL and SC
+operations. However, many architectures have strict requirements for LL/SC
+loops to ensure forward progress, such as restrictions on the number and type
+of instructions in the loop. It isn't possible to enforce these restrictions
+when the loop is expanded in LLVM IR, and so affected targets may prefer to
+expand to LL/SC loops at a very late stage (i.e. after register allocation).
+AtomicExpandPass can help support lowering of part-word atomicrmw or cmpxchg
+using this strategy by producing IR for any shifting and masking that can be
+performed outside of the LL/SC loop.
 
 Libcalls: __atomic_*
 ====================


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52234.176050.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181130/eed68d11/attachment.bin>


More information about the llvm-commits mailing list