diff options
author | Daniel Wirtz <dcode@dcode.io> | 2018-10-31 19:22:48 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-10-31 11:22:48 -0700 |
commit | 7d3ddd09d5f68945160cda3f3749a217a13928bf (patch) | |
tree | 639fea7314e6ef263ab3091f1dbfcbf410727ccc /src/js/binaryen.js-post.js | |
parent | 9c7b910d88d1d08861dd35beccd4731cf2cb5354 (diff) | |
download | binaryen-7d3ddd09d5f68945160cda3f3749a217a13928bf.tar.gz binaryen-7d3ddd09d5f68945160cda3f3749a217a13928bf.tar.bz2 binaryen-7d3ddd09d5f68945160cda3f3749a217a13928bf.zip |
Add Module#emitStackIR to the JS-API (#1717)
Related to #1716 (comment)
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r-- | src/js/binaryen.js-post.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index e34273a2a..8e4d67482 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -1162,6 +1162,16 @@ Module['Module'] = function(module) { out = old; return ret; }; + this['emitStackIR'] = function(optimize) { + this['runPasses'](['generate-stack-ir']); + if (optimize) this['runPasses'](['optimize-stack-ir']); + var old = out; + var ret = ''; + out = function(x) { ret += x + '\n' }; + this['runPasses'](['print-stack-ir']); + out = old; + return ret; + }; this['emitAsmjs'] = function() { var old = out; var ret = ''; |