Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: lib/CodeGen/TargetInfo.h

Issue 22294002: Treat __sync_synchronize and asm("":::"memory") as stronger fences. (Closed) Base URL: http://git.chromium.org/native_client/pnacl-clang.git@master
Patch Set: Make isAsmMemory a member of InlineAsm as suggested by eliben. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/CodeGen/CGStmt.cpp ('k') | lib/CodeGen/TargetInfo.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/CodeGen/TargetInfo.h
diff --git a/lib/CodeGen/TargetInfo.h b/lib/CodeGen/TargetInfo.h
index a682c183f010bb3b0e252b55ed54c0649197e6cd..a122e882e2fb277cff972ed1c487cb8937463231 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
};
}
« no previous file with comments | « lib/CodeGen/CGStmt.cpp ('k') | lib/CodeGen/TargetInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698