summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-02-01 15:02:37 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-02-01 15:04:30 -0800
commita9fee5a35d0ac49d8a90c5fcbd5a8ac0506c3724 (patch)
tree78baa8adaff4a83cab551ac38253de1fdbe8878b /src
parent5a2217d4d50c5302562ba29fb38a60edbe84d262 (diff)
downloadbinaryen-a9fee5a35d0ac49d8a90c5fcbd5a8ac0506c3724.tar.gz
binaryen-a9fee5a35d0ac49d8a90c5fcbd5a8ac0506c3724.tar.bz2
binaryen-a9fee5a35d0ac49d8a90c5fcbd5a8ac0506c3724.zip
use Return in asm2wasm
Diffstat (limited to 'src')
-rw-r--r--src/asm2wasm.h15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 3dabdc471..d29c36a6e 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -772,7 +772,6 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
};
bool seenReturn = false; // function->result is updated if we see a return
- bool needTopmost = false; // we label the topmost b lock if we need one for a return
// processors
std::function<Expression* (Ref, unsigned)> processStatements;
std::function<Expression* (Ref, unsigned)> processUnshifted;
@@ -1182,9 +1181,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
function->result = type;
}
// wasm has no return, so we just break on the topmost block
- needTopmost = true;
- auto ret = allocator.alloc<Break>();
- ret->name = TOPMOST;
+ auto ret = allocator.alloc<Return>();
ret->value = !!ast[1] ? process(ast[1]) : nullptr;
return ret;
} else if (what == BLOCK) {
@@ -1469,16 +1466,6 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
};
// body
function->body = processStatements(body, start);
- if (needTopmost) {
- Block* topmost = function->body->dyn_cast<Block>();
- // if there's no block there, or there is a block but it already has a name, we need a new block.
- if (!topmost || topmost->name.is()) {
- topmost = allocator.alloc<Block>();
- topmost->list.push_back(function->body);
- function->body = topmost;
- }
- topmost->name = TOPMOST;
- }
// cleanups/checks
assert(breakStack.size() == 0 && continueStack.size() == 0);
assert(parentLabel.isNull());