diff options
author | JF Bastien <jfb@google.com> | 2015-10-16 00:53:49 +0000 |
---|---|---|
committer | JF Bastien <jfb@google.com> | 2015-10-16 00:53:49 +0000 |
commit | 1d20a5e9e8061848c33207da5d02c6fbd706ffc1 (patch) | |
tree | 0e1bfd186c16b0b60563390a311ebdd079349fe4 /llvm/test/CodeGen/WebAssembly/func.ll | |
parent | ad5e0cefa15d81cf3688a65b55d7e26d91512150 (diff) | |
download | bcm5719-llvm-1d20a5e9e8061848c33207da5d02c6fbd706ffc1.tar.gz bcm5719-llvm-1d20a5e9e8061848c33207da5d02c6fbd706ffc1.zip |
WebAssembly: update syntax
Summary:
Follow the same syntax as for the spec repo. Both have evolved slightly
independently and need to converge again.
This, along with wasmate changes, allows me to do the following:
echo "int add(int a, int b) { return a + b; }" > add.c
./out/bin/clang -O2 -S --target=wasm32-unknown-unknown add.c -o add.wack
./experimental/prototype-wasmate/wasmate.py add.wack > add.wast
./sexpr-wasm-prototype/out/sexpr-wasm add.wast -o add.wasm
./sexpr-wasm-prototype/third_party/v8-native-prototype/v8/v8/out/Release/d8 -e "print(WASM.instantiateModule(readbuffer('add.wasm'), {print:print}).add(42, 1337));"
As you'd expect, the d8 shell prints out the right value.
Reviewers: sunfish
Subscribers: jfb, llvm-commits, dschuff
Differential Revision: http://reviews.llvm.org/D13712
llvm-svn: 250480
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/func.ll')
-rw-r--r-- | llvm/test/CodeGen/WebAssembly/func.ll | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/func.ll b/llvm/test/CodeGen/WebAssembly/func.ll index 355545a569c..7d16fd38c8a 100644 --- a/llvm/test/CodeGen/WebAssembly/func.ll +++ b/llvm/test/CodeGen/WebAssembly/func.ll @@ -14,9 +14,10 @@ define void @f0() { ; CHECK-LABEL: f1: ; CHECK-NEXT: .result i32{{$}} +; CHECK-NEXT: .local i32{{$}} ; CHECK-NEXT: i32.const 0{{$}} -; CHECK-NEXT: set_local @0, pop{{$}} -; CHECK-NEXT: return @0{{$}} +; CHECK-NEXT: set_local 0, pop{{$}} +; CHECK-NEXT: i32.return (get_local 0){{$}} ; CHECK: .size f1, define i32 @f1() { ret i32 0 @@ -26,9 +27,10 @@ define i32 @f1() { ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .param f32{{$}} ; CHECK-NEXT: .result i32{{$}} +; CHECK-NEXT: .local i32{{$}} ; CHECK-NEXT: i32.const 0{{$}} -; CHECK-NEXT: set_local @2, pop{{$}} -; CHECK-NEXT: return @2{{$}} +; CHECK-NEXT: set_local 2, pop{{$}} +; CHECK-NEXT: i32.return (get_local 2){{$}} ; CHECK: .size f2, define i32 @f2(i32 %p1, float %p2) { ret i32 0 @@ -37,7 +39,8 @@ define i32 @f2(i32 %p1, float %p2) { ; CHECK-LABEL: f3: ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .param f32{{$}} -; CHECK-NEXT: return{{$}} +; CHECK-NOT: .local +; CHECK-NEXT: void.return{{$}} ; CHECK: .size f3, define void @f3(i32 %p1, float %p2) { ret void |