You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/binaryen.js.Markdown
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,8 @@ Module property operations:
28
28
29
29
*`addFunctionType(name, resultType, paramTypes)`: Add a function type to the module, with a specified name, result type, and param types.
30
30
*`addFunction(name, functionType, varTypes, body)`: Add a function, with a name, a function type, an array of local types, and a body.
31
+
*`getFunction(name)`: Gets a function reference by name.
32
+
*`removeFunction(name)`: Removes a function by name.
31
33
*`addImport(internalName, externalModuleName, externalBaseName, functionType)`: Add an import, with an internal name (used by other things in the module), an external module name (the module from which we import), an external base name (the name we import from that module), and a function type (for function imports).
32
34
*`addExport(internalName, externalName)`: Add an export, with an internal name and an external name (the name the outside sees it exported as).
33
35
*`setFunctionTable(funcs)`: Sets the function table to a array of functions.
@@ -40,7 +42,9 @@ Module operations:
40
42
*`emitText()`: Returns a text representation of the module, in s-expression format.
41
43
*`validate()`: Validates the module, checking it for correctness.
42
44
*`optimize()`: Runs the standard optimization passes on the module.
45
+
*`optimizeFunction(func)`: Runs the standard optimization passes on a function.
43
46
*`runPasses(passes)`: Runs the specified passes on the module.
47
+
*`runPassesOnFunction(func, passes)`: Runs the specified passes on a function.
44
48
*`autoDrop()`: Automatically inserts `drop` operations. This lets you not worry about dropping when creating your code.
45
49
*`interpret()`: Run the module in the Binaryen interpreter (creates the module, and calls the start method). Useful for debugging.
46
50
*`dispose()`: Cleans up the module. If the Binaryen object can be garbage-collected anyhow, you don't need to do this, but if it stays around - e.g. if you create multiple `Module`s over time - then you should call this once a `Module` is no longer needed. (As binaryen.js uses compiled C++ code, we can't just rely on normal garbage collection to clean things up internally.)
0 commit comments