aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInfo.h
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2013-08-07 15:50:44 -0700
committerJF Bastien <jfb@chromium.org>2013-08-07 15:50:44 -0700
commit3b1ef29c338890ce55a1990389d8e63f6be7da2c (patch)
tree6a12c31173392c21830fdcd251e67907770dcede /lib/CodeGen/TargetInfo.h
parente801395572ecfeb5ba913c4064944ed7fac3e806 (diff)
Treat __sync_synchronize and asm("":::"memory") as stronger fences.
This is a companion patch to: https://codereview.chromium.org/22240002/ https://codereview.chromium.org/22474008/ and deals with the Clang-side of things. The above patch will handle the fallouts of this Clang patch, including some changes to un-duplicate work that RewriteAsmDirectives.cpp does. The goal of this patch is to force some extra ordering on non-atomics for le32 which LLVM doesn't necessarily provide. R=eliben@chromium.org TEST= ninja check-all BUG= https://code.google.com/p/nativeclient/issues/detail?id=3475 BUG= https://code.google.com/p/nativeclient/issues/detail?id=3611 Review URL: https://codereview.chromium.org/22294002
Diffstat (limited to 'lib/CodeGen/TargetInfo.h')
-rw-r--r--lib/CodeGen/TargetInfo.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/CodeGen/TargetInfo.h b/lib/CodeGen/TargetInfo.h
index a682c183f0..a122e882e2 100644
--- a/lib/CodeGen/TargetInfo.h
+++ b/lib/CodeGen/TargetInfo.h
@@ -171,6 +171,28 @@ namespace clang {
/// that unprototyped calls to varargs functions still succeed.
virtual bool isNoProtoCallVariadic(const CodeGen::CallArgList &args,
const FunctionNoProtoType *fnType) const;
+
+ // @LOCALMOD-START
+ /// Determine whether the sequentially consistent fence generated for
+ /// the legacy GCC-style ``__sync_synchronize()`` builtin should be
+ /// surrounded by empty assembly directives which touch all of
+ /// memory. This allows platforms which aim for portability to
+ /// isolate themselves from changes in sequentially consistent
+ /// fence's semantics, since its intent is to represent the
+ /// C11/C++11 memory model which only orders atomic memory accesses.
+ /// This won't guarantee that all accesses (e.g. those to
+ /// non-escaping objects) will not be reordered.
+ virtual bool addAsmMemoryAroundSyncSynchronize() const {
+ return false;
+ }
+
+ /// Determine whether a full sequentially consistent fence should be
+ /// emitted when ``asm("":::"memory")`` is encountered, treating it
+ /// like ``__sync_synchronize()``.
+ virtual bool asmMemoryIsFence() const {
+ return false;
+ }
+ // @LOCALMOD-END
};
}