aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/NaCl/PNaClABISimplify.cpp
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2013-08-07 15:50:54 -0700
committerJF Bastien <jfb@chromium.org>2013-08-07 15:50:54 -0700
commit10c5d2cb2f5611441dae3114e3803526340e4b4b (patch)
tree4c2738773744746b2d690574e8f7663fc1e6bf10 /lib/Transforms/NaCl/PNaClABISimplify.cpp
parent0791551c99b041c83413ff78c29cded7730cf601 (diff)
Add the new @llvm.nacl.atomic.fence.all intrinsic
This is a follow-up to: https://codereview.chromium.org/22240002/ And requires the Clang changes from: https://codereview.chromium.org/22294002/ This new intrinsic represents ``asm("":::"~{memory}")`` as well as ``__sync_synchronize()``, and in IR it corresponds to a sequentially-consistent fence surrounded by ``call void asm sideeffect "", "~{memory}"()``. R=jvoung@chromium.org TEST= ninja check-all BUG= https://code.google.com/p/nativeclient/issues/detail?id=3475 Review URL: https://codereview.chromium.org/22474008
Diffstat (limited to 'lib/Transforms/NaCl/PNaClABISimplify.cpp')
-rw-r--r--lib/Transforms/NaCl/PNaClABISimplify.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Transforms/NaCl/PNaClABISimplify.cpp b/lib/Transforms/NaCl/PNaClABISimplify.cpp
index 4f8e0e4f87..f662ada99a 100644
--- a/lib/Transforms/NaCl/PNaClABISimplify.cpp
+++ b/lib/Transforms/NaCl/PNaClABISimplify.cpp
@@ -30,10 +30,8 @@ void llvm::PNaClABISimplifyAddPreOptPasses(PassManager &PM) {
// LowerExpect converts Intrinsic::expect into branch weights,
// which can then be removed after BlockPlacement.
PM.add(createLowerExpectIntrinsicPass());
- // Rewrite unsupported intrinsics and inline assembly directives to
- // simpler and portable constructs.
+ // Rewrite unsupported intrinsics to simpler and portable constructs.
PM.add(createRewriteLLVMIntrinsicsPass());
- PM.add(createRewriteAsmDirectivesPass());
// LowerInvoke prevents use of C++ exception handling, which is not
// yet supported in the PNaCl ABI.
PM.add(createLowerInvokePass());
@@ -98,6 +96,10 @@ void llvm::PNaClABISimplifyAddPostOptPasses(PassManager &PM) {
PM.add(createExpandGetElementPtrPass());
// Rewrite atomic and volatile instructions with intrinsic calls.
PM.add(createRewriteAtomicsPass());
+ // Remove ``asm("":::"memory")``. This must occur after rewriting
+ // atomics: a ``fence seq_cst`` surrounded by ``asm("":::"memory")``
+ // has special meaning and is translated differently.
+ PM.add(createRemoveAsmMemoryPass());
// ReplacePtrsWithInts assumes that getelementptr instructions and
// ConstantExprs have already been expanded out.
PM.add(createReplacePtrsWithIntsPass());