diff options
| author | Derek Schuff <dschuff@google.com> | 2016-01-29 18:37:49 +0000 |
|---|---|---|
| committer | Derek Schuff <dschuff@google.com> | 2016-01-29 18:37:49 +0000 |
| commit | 6ea637af35c992cb3bece3e3e9e8de9cc42b8cd1 (patch) | |
| tree | 611323b1eb845f348b851842c19d6ed0f16f709c /llvm/test/CodeGen | |
| parent | 0df98ff9132a250aaf4b96accd1173ebe2f30ee5 (diff) | |
| download | bcm5719-llvm-6ea637af35c992cb3bece3e3e9e8de9cc42b8cd1.tar.gz bcm5719-llvm-6ea637af35c992cb3bece3e3e9e8de9cc42b8cd1.zip | |
[WebAssembly] Support frame pointer
Add support for frame pointer use in prolog/epilog.
Supports dynamic allocas but not yet over-aligned locals.
Target-independend CG generates SP updates, but we still need to write
back the SP value to memory when necessary.
llvm-svn: 259220
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/WebAssembly/userstack.ll | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/userstack.ll b/llvm/test/CodeGen/WebAssembly/userstack.ll index 72160cd9b20..4da1324260a 100644 --- a/llvm/test/CodeGen/WebAssembly/userstack.ll +++ b/llvm/test/CodeGen/WebAssembly/userstack.ll @@ -119,9 +119,36 @@ define void @allocarray_inbounds() { ; CHECK-LABEL: dynamic_alloca: define void @dynamic_alloca(i32 %alloc) { - ; TODO: Support frame pointers - ;%r = alloca i32, i32 %alloc - ;store i32 0, i32* %r + ; CHECK: i32.const [[L0:.+]]=, __stack_pointer + ; CHECK-NEXT: i32.load [[SP:.+]]=, 0([[L0]]) + ; CHECK-NEXT: copy_local [[FP:.+]]=, [[SP]] + ; Target independent codegen bumps the stack pointer + ; FIXME: we need to write the value back to memory + %r = alloca i32, i32 %alloc + ; Target-independent codegen also calculates the store addr + store i32 0, i32* %r + ; CHECK: i32.const [[L3:.+]]=, __stack_pointer + ; CHECK-NEXT: i32.store [[SP]]=, 0([[L3]]), [[FP]] + ret void +} + + +; CHECK-LABEL: dynamic_static_alloca: +define void @dynamic_static_alloca(i32 %alloc) { + ; CHECK: i32.const [[L0:.+]]=, __stack_pointer + ; CHECK-NEXT: i32.load [[L0]]=, 0([[L0]]) + ; CHECK-NEXT: i32.const [[L2:.+]]=, 16 + ; CHECK-NEXT: i32.sub [[SP:.+]]=, [[L0]], [[L2]] + ; CHECK-NEXT: copy_local [[FP:.+]]=, [[SP]] + ; CHECK-NEXT: i32.const [[L3:.+]]=, __stack_pointer + ; CHECK-NEXT: i32.store {{.*}}=, 0([[L3]]), [[SP]] + %r1 = alloca i32 + %r = alloca i32, i32 %alloc + store i32 0, i32* %r + ; CHECK: i32.const [[L3:.+]]=, 16 + ; CHECK: i32.add [[SP]]=, [[FP]], [[L3]] + ; CHECK: i32.const [[L4:.+]]=, __stack_pointer + ; CHECK-NEXT: i32.store [[SP]]=, 0([[L4]]), [[SP]] ret void } ; TODO: test aligned alloc |

