summaryrefslogtreecommitdiff
path: root/src/ast/cost.h
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2017-07-21 08:46:23 -0700
committerGitHub <noreply@github.com>2017-07-21 08:46:23 -0700
commitab8dbae1d1a27e4de24fd9ee09d45785a414922d (patch)
treeac337117d973464a16d597fc7a5c29550a93a489 /src/ast/cost.h
parentda680fdbcb7eaad1c692369c7c826fc02b00c877 (diff)
downloadbinaryen-ab8dbae1d1a27e4de24fd9ee09d45785a414922d.tar.gz
binaryen-ab8dbae1d1a27e4de24fd9ee09d45785a414922d.tar.bz2
binaryen-ab8dbae1d1a27e4de24fd9ee09d45785a414922d.zip
Optimizer support for atomic instructions (#1094)
* Teach EffectAnalyzer not to reorder atomics wrt other memory operations. * Teach EffectAnalyzer not to reorder host operations with memory operations * Teach various passes about the operands of AtomicRMW and AtomicCmpxchg * Factor out some functions in DeadCodeElimination and MergeBlocks
Diffstat (limited to 'src/ast/cost.h')
-rw-r--r--src/ast/cost.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ast/cost.h b/src/ast/cost.h
index 151468650..56050b189 100644
--- a/src/ast/cost.h
+++ b/src/ast/cost.h
@@ -78,10 +78,16 @@ struct CostAnalyzer : public Visitor<CostAnalyzer, Index> {
return 2;
}
Index visitLoad(Load *curr) {
- return 1 + visit(curr->ptr);
+ return 1 + visit(curr->ptr) + 10 * curr->isAtomic;
}
Index visitStore(Store *curr) {
- return 2 + visit(curr->ptr) + visit(curr->value);
+ return 2 + visit(curr->ptr) + visit(curr->value) + 10 * curr->isAtomic;
+ }
+ Index visitAtomicRMW(AtomicRMW *curr) {
+ return 100;
+ }
+ Index visitAtomicCmpxchg(AtomicCmpxchg* curr) {
+ return 100;
}
Index visitConst(Const *curr) {
return 1;