diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-09 17:00:25 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2018-02-09 17:00:25 +0000 |
| commit | d09b416943fec535f73950b0954e0fcd17719a75 (patch) | |
| tree | 9b193a55c6d4e422a146d77f11ac5a0ecf470dfe /llvm/test/CodeGen | |
| parent | e7da136a74ac9073528327aa8364bad97156ba51 (diff) | |
| download | bcm5719-llvm-d09b416943fec535f73950b0954e0fcd17719a75.tar.gz bcm5719-llvm-d09b416943fec535f73950b0954e0fcd17719a75.zip | |
Use assembler expressions to lay out the EH LSDA.
Rely on the assembler to finalize the layout of the DWARF/Itanium
exception-handling LSDA. Rather than calculate the exact size of each
thing in the LSDA, use assembler directives:
To emit the offset to the TTBase label:
.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
To emit the size of the call site table:
.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
... call site table entries ...
.Lcst_end0:
To align the type info table:
... action table ...
.balign 4
.long _ZTIi
.long _ZTIl
.Lttbase0:
Using assembler directives simplifies the compiler and allows switching
the encoding of offsets in the call site table from udata4 to uleb128 for
a large code size savings. (This commit does not change the encoding.)
The combination of the uleb128 followed by a balign creates an unfortunate
dependency cycle that the assembler must sometimes resolve either by
padding an LEB or by inserting zero padding before the type table. See
PR35809 or GNU as bug 4029.
Patch by Ryan Prichard!
llvm-svn: 324749
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/ehabi-handlerdata.ll | 3 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/eh-unknown.ll | 11 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/patchpoint-invoke.ll | 6 | ||||
| -rw-r--r-- | llvm/test/CodeGen/XCore/exception.ll | 10 |
5 files changed, 22 insertions, 10 deletions
diff --git a/llvm/test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll b/llvm/test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll index 517d5597bb2..ec7a002996c 100644 --- a/llvm/test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll +++ b/llvm/test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll @@ -56,6 +56,6 @@ try.cont: ; CHECK-LABEL: .Lexception0: ; CHECK: .byte 255 @ @LPStart Encoding = omit ; CHECK: .byte 0 @ @TType Encoding = absptr -; CHECK: .asciz +; CHECK: .uleb128 .Lttbase ; CHECK: .byte 3 @ Call site Encoding = udata4 ; CHECK: .fnend diff --git a/llvm/test/CodeGen/ARM/ehabi-handlerdata.ll b/llvm/test/CodeGen/ARM/ehabi-handlerdata.ll index ecb23c3424e..af5728bf831 100644 --- a/llvm/test/CodeGen/ARM/ehabi-handlerdata.ll +++ b/llvm/test/CodeGen/ARM/ehabi-handlerdata.ll @@ -51,8 +51,9 @@ try.cont: ; CHECK-LABEL: .Lexception0: ; CHECK: .byte 255 @ @LPStart Encoding = omit ; CHECK: .byte 0 @ @TType Encoding = absptr -; CHECK: .asciz +; CHECK: .uleb128 .Lttbase ; CHECK: .byte 3 @ Call site Encoding = udata4 +; CHECK: .uleb128 .Lcst_end ; CHECK: .long ; CHECK: .long ; CHECK: .long diff --git a/llvm/test/CodeGen/X86/eh-unknown.ll b/llvm/test/CodeGen/X86/eh-unknown.ll index 7c495bdadc6..f9f3696a869 100644 --- a/llvm/test/CodeGen/X86/eh-unknown.ll +++ b/llvm/test/CodeGen/X86/eh-unknown.ll @@ -23,10 +23,13 @@ entry: ; CHECK: .Lexception0: ; CHECK: .byte 255 # @LPStart Encoding = omit ; CHECK: .byte 0 # @TType Encoding = absptr -; CHECK: .asciz "\217\200" # @TType base offset +; CHECK: .uleb128 .Lttbase0-.Lttbaseref0 +; CHECK: .Lttbaseref0: ; CHECK: .byte 3 # Call site Encoding = udata4 -; CHECK: .byte 13 # Call site table length -; CHECK: .long .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 << -; CHECK: .long .Lfunc_end0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Lfunc_end0 +; CHECK: .uleb128 .Lcst_end0-.Lcst_begin0 +; CHECK: .Lcst_begin0: +; CHECK: .long .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 << +; CHECK: .long .Lfunc_end0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Lfunc_end0 ; CHECK: .long 0 # has no landing pad ; CHECK: .byte 0 # On action: cleanup +; CHECK: .Lcst_end0: diff --git a/llvm/test/CodeGen/X86/patchpoint-invoke.ll b/llvm/test/CodeGen/X86/patchpoint-invoke.ll index 9270bf2b06b..df273777675 100644 --- a/llvm/test/CodeGen/X86/patchpoint-invoke.ll +++ b/llvm/test/CodeGen/X86/patchpoint-invoke.ll @@ -34,9 +34,11 @@ threw: ; CHECK: [[EXCEPTION_LABEL]]: ; CHECK-NEXT: .byte 255 ; CHECK-NEXT: .byte 3 -; CHECK-NEXT: .byte 21 +; CHECK-NEXT: .uleb128 .Lttbase{{[0-9]+}}-[[TTBASEREF:.Lttbaseref[0-9]+]] +; CHECK-NEXT: [[TTBASEREF]]: ; CHECK-NEXT: .byte 3 -; CHECK-NEXT: .byte 13 +; CHECK-NEXT: .uleb128 .Lcst_end{{[0-9]+}}-[[CST_BEGIN:.Lcst_begin[0-9]+]] +; CHECK-NEXT: [[CST_BEGIN]]: ; Verify that the unwind data covers the entire patchpoint region: ; CHECK-NEXT: .long .Ltmp0-[[FUNC_BEGIN]] ; CHECK-NEXT: .long [[PP_END]]-.Ltmp0 diff --git a/llvm/test/CodeGen/XCore/exception.ll b/llvm/test/CodeGen/XCore/exception.ll index dd7e012f737..988001043d0 100644 --- a/llvm/test/CodeGen/XCore/exception.ll +++ b/llvm/test/CodeGen/XCore/exception.ll @@ -105,9 +105,11 @@ Exit: ; CHECK: [[LSDA]]: ; CHECK: .byte 255 ; CHECK: .byte 0 -; CHECK: .asciiz +; CHECK: .uleb128 [[TTBASE:.Lttbase[0-9]+]]-[[TTBASEREF:.Lttbaseref[0-9]+]] +; CHECK: [[TTBASEREF]]: ; CHECK: .byte 3 -; CHECK: .byte 26 +; CHECK: .uleb128 [[CST_END:.Lcst_end[0-9]+]]-[[CST_BEGIN:.Lcst_begin[0-9]+]] +; CHECK: [[CST_BEGIN]]: ; CHECK: .long [[PRE_G]]-[[START]] ; CHECK: .long [[POST_G]]-[[PRE_G]] ; CHECK: .long [[LANDING]]-[[START]] @@ -116,10 +118,14 @@ Exit: ; CHECK: .long [[END]]-[[POST_G]] ; CHECK: .long 0 ; CHECK: .byte 0 +; CHECK: [[CST_END]]: +; CHECK: .byte 0 ; CHECK: .byte 0 ; CHECK: .byte 1 ; CHECK: .byte 125 ; CHECK: .byte 2 ; CHECK: .byte 125 +; CHECK: .p2align 2 ; CHECK: .long _ZTIi ; CHECK: .long _ZTId +; CHECK: [[TTBASE]]: |

