summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
authorJérôme Vouillon <jerome.vouillon@gmail.com>2024-07-16 16:36:47 -0400
committerGitHub <noreply@github.com>2024-07-16 13:36:47 -0700
commit43e8809d2683706b1ce43861ac8f9447d96a5273 (patch)
tree4033cbeacca1b0c8177cec2a879bfd5433ef2140 /src/js/binaryen.js-post.js
parent53b7dd1f0f129f0304a045ea00ce92334c01fb75 (diff)
downloadbinaryen-43e8809d2683706b1ce43861ac8f9447d96a5273.tar.gz
binaryen-43e8809d2683706b1ce43861ac8f9447d96a5273.tar.bz2
binaryen-43e8809d2683706b1ce43861ac8f9447d96a5273.zip
Add C and JS APIs to control more pass options (#6713)
Add functions to: * Set and get the trapsNeverHappen, closedWorld, generateStackIR and optimizeStackIR flags * Manage the list of passes to skip.
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 097c28bc7..55e1a7ad7 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -3412,6 +3412,30 @@ Module['setDebugInfo'] = function(on) {
Module['_BinaryenSetDebugInfo'](on);
};
+// Gets whether no traps can be considered reached at runtime when optimizing.
+Module['getTrapsNeverHappen'] = function() {
+ return Boolean(Module['_BinaryenGetTrapsNeverHappen']());
+};
+
+// Enables or disables whether no traps can be considered reached at
+// runtime when optimizing.
+Module['setTrapsNeverHappen'] = function(on) {
+ Module['_BinaryenSetTrapsNeverHappen'](on);
+};
+
+// Gets whether considering that the code outside of the module does
+// not inspect or interact with GC and function references.
+Module['getClosedWorld'] = function() {
+ return Boolean(Module['_BinaryenGetClosedWorld']());
+};
+
+// Enables or disables whether considering that the code outside of
+// the module does not inspect or interact with GC and function
+// references.
+Module['setClosedWorld'] = function(on) {
+ Module['_BinaryenSetClosedWorld'](on);
+};
+
// Gets whether the low 1K of memory can be considered unused when optimizing.
Module['getLowMemoryUnused'] = function() {
return Boolean(Module['_BinaryenGetLowMemoryUnused']());
@@ -3445,6 +3469,26 @@ Module['setFastMath'] = function(value) {
Module['_BinaryenSetFastMath'](value);
};
+// Gets whether to generate StackIR during binary writing.
+Module['getGenerateStackIR'] = function() {
+ return Boolean(Module['_BinaryenGetGenerateStackIR']());
+};
+
+// Enable or disable StackIR generation during binary writing.
+Module['setGenerateStackIR'] = function(value) {
+ Module['_BinaryenSetGenerateStackIR'](value);
+};
+
+// Gets whether to optimize StackIR during binary writing.
+Module['getOptimizeStackIR'] = function() {
+ return Boolean(Module['_BinaryenGetOptimizeStackIR']());
+};
+
+// Enable or disable StackIR optimisation during binary writing.
+Module['setOptimizeStackIR'] = function(value) {
+ Module['_BinaryenSetOptimizeStackIR'](value);
+};
+
// Gets the value of the specified arbitrary pass argument.
Module['getPassArgument'] = function(key) {
return preserveStack(() => {
@@ -3464,6 +3508,23 @@ Module['clearPassArguments'] = function() {
Module['_BinaryenClearPassArguments']();
};
+// Gets whether a pass is in the set of passes to skip.
+Module['hasPassToSkip'] = function(pass) {
+ return preserveStack(() => {
+ return Boolean(Module['_BinaryenHasPassToSkip'](strToStack(pass)));
+ });
+};
+
+// Add a pass to the set of passes to skip.
+Module['addPassToSkip'] = function (pass) {
+ preserveStack(() => { Module['_BinaryenAddPassToSkip'](strToStack(pass)) });
+};
+
+// Clears the set of passes to skip.
+Module['clearPassesToSkip'] = function() {
+ Module['_BinaryenClearPassesToSkip']();
+};
+
// Gets the function size at which we always inline.
Module['getAlwaysInlineMaxSize'] = function() {
return Module['_BinaryenGetAlwaysInlineMaxSize']();