Chromium Code Reviews| Index: lib/CodeGen/CGStmt.cpp |
| diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp |
| index 5e2ebe0d9cd4656e9278c6a172513dc09ed0d77f..02ef13058637643650b0d80cd9526c49abb3dd63 100644 |
| --- a/lib/CodeGen/CGStmt.cpp |
| +++ b/lib/CodeGen/CGStmt.cpp |
| @@ -22,6 +22,7 @@ |
| #include "llvm/IR/DataLayout.h" |
| #include "llvm/IR/InlineAsm.h" |
| #include "llvm/IR/Intrinsics.h" |
| +#include "llvm/IR/NaClAsm.h" // @LOCALMOD |
|
eliben
2013/08/07 18:06:25
This is a problem for upstreaming, no?
From the o
JF
2013/08/07 19:48:12
Done.
|
| using namespace clang; |
| using namespace CodeGen; |
| @@ -1701,6 +1702,18 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { |
| Result->addAttribute(llvm::AttributeSet::FunctionIndex, |
| llvm::Attribute::NoUnwind); |
| + // @LOCALMOD-START |
| + if (getTargetHooks().asmMemoryIsFence() && llvm::NaCl::isAsmMemory(Result)) { |
|
eliben
2013/08/07 18:06:25
It's weird that you're going the generic way with
JF
2013/08/07 19:48:12
Done.
|
| + // 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. FIXME: Handle metadata for MS-style inline asms. |
| if (const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S)) |