summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binaryen-c.cpp40
-rw-r--r--src/binaryen-c.h46
-rw-r--r--src/js/binaryen.js-post.js61
3 files changed, 147 insertions, 0 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index 298a50233..afc3dbe54 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -5373,6 +5373,18 @@ bool BinaryenGetDebugInfo(void) { return globalPassOptions.debugInfo; }
void BinaryenSetDebugInfo(bool on) { globalPassOptions.debugInfo = on != 0; }
+bool BinaryenGetTrapsNeverHappen(void) {
+ return globalPassOptions.trapsNeverHappen;
+}
+
+void BinaryenSetTrapsNeverHappen(bool on) {
+ globalPassOptions.trapsNeverHappen = on;
+}
+
+bool BinaryenGetClosedWorld(void) { return globalPassOptions.closedWorld; }
+
+void BinaryenSetClosedWorld(bool on) { globalPassOptions.closedWorld = on; }
+
bool BinaryenGetLowMemoryUnused(void) {
return globalPassOptions.lowMemoryUnused;
}
@@ -5393,6 +5405,22 @@ bool BinaryenGetFastMath(void) { return globalPassOptions.fastMath; }
void BinaryenSetFastMath(bool value) { globalPassOptions.fastMath = value; }
+bool BinaryenGetGenerateStackIR(void) {
+ return globalPassOptions.generateStackIR;
+}
+
+void BinaryenSetGenerateStackIR(bool on) {
+ globalPassOptions.generateStackIR = on;
+}
+
+bool BinaryenGetOptimizeStackIR(void) {
+ return globalPassOptions.optimizeStackIR;
+}
+
+void BinaryenSetOptimizeStackIR(bool on) {
+ globalPassOptions.optimizeStackIR = on;
+}
+
const char* BinaryenGetPassArgument(const char* key) {
assert(key);
const auto& args = globalPassOptions.arguments;
@@ -5415,6 +5443,18 @@ void BinaryenSetPassArgument(const char* key, const char* value) {
void BinaryenClearPassArguments(void) { globalPassOptions.arguments.clear(); }
+bool BinaryenHasPassToSkip(const char* pass) {
+ assert(pass);
+ return globalPassOptions.passesToSkip.count(pass);
+}
+
+void BinaryenAddPassToSkip(const char* pass) {
+ assert(pass);
+ globalPassOptions.passesToSkip.insert(pass);
+}
+
+void BinaryenClearPassesToSkip(void) { globalPassOptions.passesToSkip.clear(); }
+
BinaryenIndex BinaryenGetAlwaysInlineMaxSize(void) {
return globalPassOptions.inlining.alwaysInlineMaxSize;
}
diff --git a/src/binaryen-c.h b/src/binaryen-c.h
index 35f1d8eb8..0b1319f30 100644
--- a/src/binaryen-c.h
+++ b/src/binaryen-c.h
@@ -2925,6 +2925,24 @@ BINARYEN_API bool BinaryenGetDebugInfo(void);
// Applies to all modules, globally.
BINARYEN_API void BinaryenSetDebugInfo(bool on);
+// Gets whether no traps can be considered reached at runtime when optimizing.
+// Applies to all modules, globally.
+BINARYEN_API bool BinaryenGetTrapsNeverHappen(void);
+
+// Enables or disables whether no traps can be considered reached at
+// runtime when optimizing. Applies to all modules, globally.
+BINARYEN_API void BinaryenSetTrapsNeverHappen(bool on);
+
+// Gets whether considering that the code outside of the module does
+// not inspect or interact with GC and function references. Applies to
+// all modules, globally.
+BINARYEN_API bool BinaryenGetClosedWorld(void);
+
+// Enables or disables whether considering that the code outside of
+// the module does not inspect or interact with GC and function
+// references. Applies to all modules, globally.
+BINARYEN_API void BinaryenSetClosedWorld(bool on);
+
// Gets whether the low 1K of memory can be considered unused when optimizing.
// Applies to all modules, globally.
BINARYEN_API bool BinaryenGetLowMemoryUnused(void);
@@ -2950,6 +2968,22 @@ BINARYEN_API bool BinaryenGetFastMath(void);
// Applies to all modules, globally.
BINARYEN_API void BinaryenSetFastMath(bool value);
+// Gets whether to generate StackIR during binary writing.
+// Applies to all modules, globally.
+BINARYEN_API bool BinaryenGetGenerateStackIR(void);
+
+// Enable or disable StackIR generation during binary writing.
+// Applies to all modules, globally.
+BINARYEN_API void BinaryenSetGenerateStackIR(bool on);
+
+// Gets whether to optimize StackIR during binary writing.
+// Applies to all modules, globally.
+BINARYEN_API bool BinaryenGetOptimizeStackIR(void);
+
+// Enable or disable StackIR optimization during binary writing.
+// Applies to all modules, globally.
+BINARYEN_API void BinaryenSetOptimizeStackIR(bool on);
+
// Gets the value of the specified arbitrary pass argument.
// Applies to all modules, globally.
BINARYEN_API const char* BinaryenGetPassArgument(const char* name);
@@ -2962,6 +2996,18 @@ BINARYEN_API void BinaryenSetPassArgument(const char* name, const char* value);
// Applies to all modules, globally.
BINARYEN_API void BinaryenClearPassArguments();
+// Gets whether a pass is in the set of passes to skip.
+// Applies to all modules, globally.
+BINARYEN_API bool BinaryenHasPassToSkip(const char* pass);
+
+// Add a pass to the set of passes to skip.
+// Applies to all modules, globally.
+BINARYEN_API void BinaryenAddPassToSkip(const char* pass);
+
+// Clears the set of passes to skip.
+// Applies to all modules, globally.
+BINARYEN_API void BinaryenClearPassesToSkip(void);
+
// Gets the function size at which we always inline.
// Applies to all modules, globally.
BINARYEN_API BinaryenIndex BinaryenGetAlwaysInlineMaxSize(void);
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']();