summaryrefslogtreecommitdiff
path: root/src/binaryen-c.h
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2017-11-21 21:43:12 +0100
committerAlon Zakai <alonzakai@gmail.com>2017-11-21 12:43:12 -0800
commiteedcc291164a46474116e0e54ede3133214a7621 (patch)
tree6350e315b74464f48c4f02c6c77a1338b630e144 /src/binaryen-c.h
parent07c54750eb626ea7434341e439f6cee75efbf4b5 (diff)
downloadbinaryen-eedcc291164a46474116e0e54ede3133214a7621.tar.gz
binaryen-eedcc291164a46474116e0e54ede3133214a7621.tar.bz2
binaryen-eedcc291164a46474116e0e54ede3133214a7621.zip
Running passes on a single function in binaryen-c/.js (#1295)
* Also other function utilities in C and JS APIs
Diffstat (limited to 'src/binaryen-c.h')
-rw-r--r--src/binaryen-c.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/binaryen-c.h b/src/binaryen-c.h
index 54cc73ace..da5362d24 100644
--- a/src/binaryen-c.h
+++ b/src/binaryen-c.h
@@ -400,6 +400,12 @@ typedef void* BinaryenFunctionRef;
// at indexes 1 and 2, etc., that is, they share an index space.
BinaryenFunctionRef BinaryenAddFunction(BinaryenModuleRef module, const char* name, BinaryenFunctionTypeRef type, BinaryenType* varTypes, BinaryenIndex numVarTypes, BinaryenExpressionRef body);
+// Gets a function reference by name.
+BinaryenFunctionRef BinaryenGetFunction(BinaryenModuleRef module, const char* name);
+
+// Removes a function by name.
+void BinaryenRemoveFunction(BinaryenModuleRef module, const char* name);
+
// Imports
typedef void* BinaryenImportRef;
@@ -451,7 +457,7 @@ void BinaryenModulePrintAsmjs(BinaryenModuleRef module);
// @return 0 if an error occurred, 1 if validated succesfully
int BinaryenModuleValidate(BinaryenModuleRef module);
-// Run the standard optimization passes on the module.
+// Runs the standard optimization passes on the module.
void BinaryenModuleOptimize(BinaryenModuleRef module);
// Runs the specified passes on the module.
@@ -475,6 +481,19 @@ BinaryenModuleRef BinaryenModuleRead(char* input, size_t inputSize);
void BinaryenModuleInterpret(BinaryenModuleRef module);
//
+// ========== Function Operations ==========
+//
+
+// Gets the body of the function.
+BinaryenExpressionRef BinaryenFunctionGetBody(BinaryenFunctionRef func);
+
+// Runs the standard optimization passes on the function.
+void BinaryenFunctionOptimize(BinaryenFunctionRef func, BinaryenModuleRef module);
+
+// Runs the specified passes on the function.
+void BinaryenFunctionRunPasses(BinaryenFunctionRef func, BinaryenModuleRef module, const char **passes, BinaryenIndex numPasses);
+
+//
// ========== CFG / Relooper ==========
//
// General usage is (1) create a relooper, (2) create blocks, (3) add