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

Unified Diff: lib/CodeGen/CGStmt.cpp

Issue 887223008: Rebased localmods in clang to 223109. (Closed)
Patch Set: Created 5 years, 10 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/CGBuiltin.cpp ('k') | lib/CodeGen/TargetInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/CodeGen/CGStmt.cpp
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index f207a4f7f8d1cee77cc7433050c244ba1acca724..1064e5115a8e1d02b783a3b3327ba64172c6a60b 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -2044,6 +2044,18 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
Result->addAttribute(llvm::AttributeSet::FunctionIndex,
llvm::Attribute::NoUnwind);
+ // @LOCALMOD-START
+ if (getTargetHooks().asmMemoryIsFence() && IA->isAsmMemory()) {
+ // Targets can ask that ``asm("":::"memory")`` be treated like
+ // ``__sync_synchronize()``.
+ Builder.CreateFence(llvm::SequentiallyConsistent);
+ Builder.CreateCall(
+ llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect))->
+ addAttribute(llvm::AttributeSet::FunctionIndex,
+ llvm::Attribute::NoUnwind);
+ }
+ // @LOCALMOD-END
+
// Slap the source location of the inline asm into a !srcloc metadata on the
// call.
if (const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S)) {
« no previous file with comments | « lib/CodeGen/CGBuiltin.cpp ('k') | lib/CodeGen/TargetInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698