summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-15 14:58:56 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-15 14:58:56 -0800
commit46b1677c8020e20b4b27689646022090ced3c07b (patch)
tree91c2c22c3f3da6233bb29c6b0aab9940b4300278 /src
parent0fff336950b8397ae7db7081eafe075565366b25 (diff)
downloadbinaryen-46b1677c8020e20b4b27689646022090ced3c07b.tar.gz
binaryen-46b1677c8020e20b4b27689646022090ced3c07b.tar.bz2
binaryen-46b1677c8020e20b4b27689646022090ced3c07b.zip
comments
Diffstat (limited to 'src')
-rw-r--r--src/wasm.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 2061eb5d5..9443de4a8 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -32,6 +32,8 @@ namespace wasm {
// We use a Name for all of the identifiers. These are IStrings, so they are
// all interned - comparisons etc are just pointer comparisons, so there is no
// perf loss. Having names everywhere makes using the AST much nicer.
+// TODO: as an optimization, IString values < some threshold could be considered
+// numerical indices directly.
struct Name : public cashew::IString {
Name() : cashew::IString() {}
@@ -232,7 +234,20 @@ enum HostOp {
PageSize, MemorySize, GrowMemory, HasFeature
};
+//
// Expressions
+//
+// Note that little is provided in terms of constructors for these. The rationale
+// is that writing new Something(a, b, c, d, e) is not the clearest, and it would
+// be better to write new Something(name=a, leftOperand=b... etc., but C++
+// lacks named operands, so in asm2wasm etc. you will see things like
+// auto x = new Something();
+// x->name = a;
+// x->leftOperand = b;
+// ..
+// which is less compact but less ambiguous. But hopefully we can do better,
+// suggestions for API improvements here are welcome.
+//
class Expression {
public: