Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebAssembly] Make assembler check for proper nesting of control flow.
Summary: It does so using a simple nesting stack, and gives clear errors upon violation. This is unique to wasm, since most CPUs do not have any nested constructs. Had to add an end of file check to the general assembler for this. Note: if/else/end instructions are not currently supported in our tablegen defs, so these tests will be enabled in a follow-up. They already pass the nesting check. Reviewers: dschuff, aheejin Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D55797 llvm-svn: 350078
- Loading branch information
Showing
6 changed files
with
151 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# RUN: not llvm-mc -triple=wasm32-unknown-unknown -mattr=+simd128,+nontrapping-fptoint,+exception-handling < %s 2>&1 | FileCheck %s | ||
|
||
.text | ||
.section .text.main,"",@ | ||
.type test0,@function | ||
# CHECK: End of block construct with no start: end_try | ||
end_try | ||
test0: | ||
.functype test0 () -> () | ||
# CHECK: Block construct type mismatch, expected: end_function, instead got: end_loop | ||
end_loop | ||
block | ||
# CHECK: Block construct type mismatch, expected: end_block, instead got: end_if | ||
end_if | ||
try | ||
loop | ||
# CHECK: Block construct type mismatch, expected: end_loop, instead got: end_function | ||
# CHECK: error: Unmatched block construct(s) at function end: loop | ||
# CHECK: error: Unmatched block construct(s) at function end: try | ||
# CHECK: error: Unmatched block construct(s) at function end: block | ||
# CHECK: error: Unmatched block construct(s) at function end: function | ||
end_function | ||
.Lfunc_end0: | ||
.size test0, .Lfunc_end0-test0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters