diff options
| author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-01-07 01:30:53 +0000 |
|---|---|---|
| committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-01-07 01:30:53 +0000 |
| commit | 6047b6e14029e5dec3906745fd11c81676c108e9 (patch) | |
| tree | 508a232723d7f42f4cd62db1850807775b2e376a /llvm/test/CodeGen/Generic/GC/redundant_init.ll | |
| parent | 5180e8567502c8c2dbee52734e3a322b54a82577 (diff) | |
| download | bcm5719-llvm-6047b6e14029e5dec3906745fd11c81676c108e9.tar.gz bcm5719-llvm-6047b6e14029e5dec3906745fd11c81676c108e9.zip | |
With this patch, the LowerGC transformation becomes the
ShadowStackCollector, which additionally has reduced overhead with
no sacrifice in portability.
Considering a function @fun with 8 loop-local roots,
ShadowStackCollector introduces the following overhead
(x86):
; shadowstack prologue
movl L_llvm_gc_root_chain$non_lazy_ptr, %eax
movl (%eax), %ecx
movl $___gc_fun, 20(%esp)
movl $0, 24(%esp)
movl $0, 28(%esp)
movl $0, 32(%esp)
movl $0, 36(%esp)
movl $0, 40(%esp)
movl $0, 44(%esp)
movl $0, 48(%esp)
movl $0, 52(%esp)
movl %ecx, 16(%esp)
leal 16(%esp), %ecx
movl %ecx, (%eax)
; shadowstack loop overhead
(none)
; shadowstack epilogue
movl 48(%esp), %edx
movl %edx, (%ecx)
; shadowstack metadata
.align 3
___gc_fun: # __gc_fun
.long 8
.space 4
In comparison to LowerGC:
; lowergc prologue
movl L_llvm_gc_root_chain$non_lazy_ptr, %eax
movl (%eax), %ecx
movl %ecx, 48(%esp)
movl $8, 52(%esp)
movl $0, 60(%esp)
movl $0, 56(%esp)
movl $0, 68(%esp)
movl $0, 64(%esp)
movl $0, 76(%esp)
movl $0, 72(%esp)
movl $0, 84(%esp)
movl $0, 80(%esp)
movl $0, 92(%esp)
movl $0, 88(%esp)
movl $0, 100(%esp)
movl $0, 96(%esp)
movl $0, 108(%esp)
movl $0, 104(%esp)
movl $0, 116(%esp)
movl $0, 112(%esp)
; lowergc loop overhead
leal 44(%esp), %eax
movl %eax, 56(%esp)
leal 40(%esp), %eax
movl %eax, 64(%esp)
leal 36(%esp), %eax
movl %eax, 72(%esp)
leal 32(%esp), %eax
movl %eax, 80(%esp)
leal 28(%esp), %eax
movl %eax, 88(%esp)
leal 24(%esp), %eax
movl %eax, 96(%esp)
leal 20(%esp), %eax
movl %eax, 104(%esp)
leal 16(%esp), %eax
movl %eax, 112(%esp)
; lowergc epilogue
movl 48(%esp), %edx
movl %edx, (%ecx)
; lowergc metadata
(none)
llvm-svn: 45670
Diffstat (limited to 'llvm/test/CodeGen/Generic/GC/redundant_init.ll')
| -rw-r--r-- | llvm/test/CodeGen/Generic/GC/redundant_init.ll | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Generic/GC/redundant_init.ll b/llvm/test/CodeGen/Generic/GC/redundant_init.ll new file mode 100644 index 00000000000..44996034748 --- /dev/null +++ b/llvm/test/CodeGen/Generic/GC/redundant_init.ll @@ -0,0 +1,17 @@ +; RUN: llvm-as < %s | llc -march=x86 | \ +; RUN: ignore grep {movl..0} | count 0 + +%struct.obj = type { i8*, %struct.obj* } + +declare void @g() gc "shadow-stack" + +define void @f(i8* %o) gc "shadow-stack" { +entry: + %root = alloca i8* + call void @llvm.gcroot(i8** %root, i8* null) + store i8* %o, i8** %root + call void @g() + ret void +} + +declare void @llvm.gcroot(i8**, i8*) |

