From 47f3513dd574535aeb40c9eb11134f0899e92269 Mon Sep 17 00:00:00 2001
From: Eli Friedman
+ fence [singlethread] <ordering> ; yields {void} ++ +
The 'fence' instruction is used to introduce happens-before edges +between operations.
+ +'fence
' instructions take an ordering argument which defines what
+synchronizes-with edges they add. They can only be given
+acquire
, release
, acq_rel
, and
+seq_cst
orderings.
A fence A which has (at least) release
ordering
+semantics synchronizes with a fence B with (at least)
+acquire
ordering semantics if and only if there exist atomic
+operations X and Y, both operating on some atomic object
+M, such that A is sequenced before X,
+X modifies M (either directly or through some side effect
+of a sequence headed by X), Y is sequenced before
+B, and Y observes M. This provides a
+happens-before dependency between A and B. Rather
+than an explicit fence
, one (but not both) of the atomic operations
+X or Y might provide a release
or
+acquire
(resp.) ordering constraint and still
+synchronize-with the explicit fence
and establish the
+happens-before edge.
A fence
which has seq_cst
ordering, in addition to
+having both acquire
and release
semantics specified
+above, participates in the global program order of other seq_cst
+operations and/or fences.
The optional "singlethread
" argument
+specifies that the fence only synchronizes with other fences in the same
+thread. (This is useful for interacting with signal handlers.)
FIXME: This instruction is a work in progress; until it is finished, use + llvm.memory.barrier. + +
+ fence acquire ; yields {void} + fence singlethread seq_cst ; yields {void} ++ +