summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-29 20:23:56 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-29 22:16:58 -0800
commita7dccb1294a258793203720b1dc889a5993c95bb (patch)
treeb712ad4b095dfdabf3c48e73117dea8b83705663 /src/wasm-binary.h
parent1e765b3b8b34ec48c8cdccd79667d2e5c957d983 (diff)
downloadbinaryen-a7dccb1294a258793203720b1dc889a5993c95bb.tar.gz
binaryen-a7dccb1294a258793203720b1dc889a5993c95bb.tar.bz2
binaryen-a7dccb1294a258793203720b1dc889a5993c95bb.zip
more binary stuff, all but unary+binary
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r--src/wasm-binary.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index d05225601..dec991add 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -189,6 +189,7 @@ enum ASTNodes {
CallFunction = 0x12,
CallIndirect = 0x13,
+ Nop = 0x00,
Block = 0x01,
Loop = 0x02,
If = 0x03,
@@ -521,27 +522,31 @@ public:
void visitBinary(Binary *curr) {
}
void visitSelect(Select *curr) {
+ o << int8_t(ASTNodes::Select);
+ visit(curr->ifTrue);
+ visit(curr->ifFalse);
+ visit(curr->condition);
}
void visitHost(Host *curr) {
+ switch (curr->op) {
+ case MemorySize: {
+ o << int8_t(ASTNodes::MemorySize);
+ break;
+ }
+ case GrowMemory: {
+ o << int8_t(ASTNodes::GrowMemory);
+ visit(curr->operands[0]);
+ break;
+ }
+ default: abort();
+ }
+ return o;
}
void visitNop(Nop *curr) {
+ o << int8_t(ASTNodes::Nop);
}
void visitUnreachable(Unreachable *curr) {
- }
- // Module-level visitors
- void visitFunctionType(FunctionType *curr) {
- }
- void visitImport(Import *curr) {
- }
- void visitExport(Export *curr) {
- }
- void visitFunction(Function *curr) {
- }
- void visitTable(Table *curr) {
- }
- void visitMemory(Memory *curr) {
- }
- void visitModule(Module *curr) {
+ o << int8_t(ASTNodes::Unreachable);
}
};
@@ -553,7 +558,7 @@ public:
WasmBinaryBuilder(AllocatingModule& wasm, istream& i) : wasm(wasm), allocator(wasm.allocator), i(i) {}
void read() {
- //
+ abort(); // TODO
}
};