summaryrefslogtreecommitdiff
path: root/src/binaryen-c.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-07-07 12:49:51 -0700
committerGitHub <noreply@github.com>2016-07-07 12:49:51 -0700
commite74dcc425dfb95bbf0bb296fa0d6c4494355b6e1 (patch)
tree79fdef328a97cc41bde7181c6b7124b27bd36373 /src/binaryen-c.h
parent9455a8749e1bb2c4788c37495b9cd319f046f6ff (diff)
parent4215d5f76f151fe2c4609db7f6041c4354851af3 (diff)
downloadbinaryen-e74dcc425dfb95bbf0bb296fa0d6c4494355b6e1.tar.gz
binaryen-e74dcc425dfb95bbf0bb296fa0d6c4494355b6e1.tar.bz2
binaryen-e74dcc425dfb95bbf0bb296fa0d6c4494355b6e1.zip
Merge pull request #622 from WebAssembly/duffs-device-test
Add a relooper test for duff's device, and c api improvements
Diffstat (limited to 'src/binaryen-c.h')
-rw-r--r--src/binaryen-c.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/binaryen-c.h b/src/binaryen-c.h
index 7f9a775d5..3f940c0cc 100644
--- a/src/binaryen-c.h
+++ b/src/binaryen-c.h
@@ -285,6 +285,10 @@ BinaryenExpressionRef BinaryenCallIndirect(BinaryenModuleRef module, BinaryenExp
// type or their opcode, or failing that, their children. But
// GetLocal has no children, it is where a "stream" of type info
// begins.)
+// Note also that the index of a local can refer to a param or
+// a var, that is, either a parameter to the function or a variable
+// declared when you call BinaryenAddFunction. See BinaryenAddFunction
+// for more details.
BinaryenExpressionRef BinaryenGetLocal(BinaryenModuleRef module, BinaryenIndex index, BinaryenType type);
BinaryenExpressionRef BinaryenSetLocal(BinaryenModuleRef module, BinaryenIndex index, BinaryenExpressionRef value);
// Load: align can be 0, in which case it will be the natural alignment (equal to bytes)
@@ -310,7 +314,14 @@ void BinaryenExpressionPrint(BinaryenExpressionRef expr);
typedef void* BinaryenFunctionRef;
// Adds a function to the module. This is thread-safe.
-BinaryenFunctionRef BinaryenAddFunction(BinaryenModuleRef module, const char* name, BinaryenFunctionTypeRef type, BinaryenType* localTypes, BinaryenIndex numLocalTypes, BinaryenExpressionRef body);
+// @varTypes: the types of variables. In WebAssembly, vars share
+// an index space with params. In other words, params come from
+// the function type, and vars are provided in this call, and
+// together they are all the locals. The order is first params
+// and then vars, so if you have one param it will be at index
+// 0 (and written $0), and if you also have 2 vars they will be
+// 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);
// Imports