diff options
author | Derek Schuff <dschuff@chromium.org> | 2017-07-21 08:46:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-21 08:46:23 -0700 |
commit | ab8dbae1d1a27e4de24fd9ee09d45785a414922d (patch) | |
tree | ac337117d973464a16d597fc7a5c29550a93a489 /src/ast/cost.h | |
parent | da680fdbcb7eaad1c692369c7c826fc02b00c877 (diff) | |
download | binaryen-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.h | 10 |
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; |