summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-09-29 20:12:33 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-09-29 20:12:33 +0000
commita80c1512861aa78f75a89b92275aaf2e92ff7fb9 (patch)
treeb5d4c3efc67ff022eb8a71ad379dc01a1447a46f /llvm/test/CodeGen
parent81f005617e42e64b553a5ded37f1afac9b3fb4cc (diff)
downloadbcm5719-llvm-a80c1512861aa78f75a89b92275aaf2e92ff7fb9.tar.gz
bcm5719-llvm-a80c1512861aa78f75a89b92275aaf2e92ff7fb9.zip
[WinEH] Teach AsmPrinter about funclets
Summary: Funclets have been turned into functions by the time they hit the object file. Make sure that they have decent names for the symbol table and CFI directives explaining how to reason about their prologues. Differential Revision: http://reviews.llvm.org/D13261 llvm-svn: 248824
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/WinEH/seh-prepared-basic.ll3
-rw-r--r--llvm/test/CodeGen/X86/gcc_except_table.ll2
-rw-r--r--llvm/test/CodeGen/X86/seh-catch-all.ll4
-rw-r--r--llvm/test/CodeGen/X86/seh-except-finally.ll4
-rw-r--r--llvm/test/CodeGen/X86/seh-finally.ll4
-rw-r--r--llvm/test/CodeGen/X86/seh-safe-div.ll4
-rw-r--r--llvm/test/CodeGen/X86/win-catchpad-csrs.ll10
-rw-r--r--llvm/test/CodeGen/X86/win-catchpad.ll20
-rw-r--r--llvm/test/CodeGen/X86/win-cleanuppad.ll45
-rw-r--r--llvm/test/CodeGen/X86/win-funclet-cfi.ll100
10 files changed, 164 insertions, 32 deletions
diff --git a/llvm/test/CodeGen/WinEH/seh-prepared-basic.ll b/llvm/test/CodeGen/WinEH/seh-prepared-basic.ll
index d4ff04c9fe1..51ffe7bb3bd 100644
--- a/llvm/test/CodeGen/WinEH/seh-prepared-basic.ll
+++ b/llvm/test/CodeGen/WinEH/seh-prepared-basic.ll
@@ -35,6 +35,9 @@ __try.cont: ; preds = %lpad1, %entry
; CHECK: .seh_handler __C_specific_handler
; CHECK-NOT: jmpq *
; CHECK: .seh_handlerdata
+; CHECK-NEXT: .text
+; CHECK: .seh_endproc
+; CHECK: .section .xdata,"dr"
; CHECK-NEXT: .long 1
; CHECK-NEXT: .long .Ltmp{{.*}}
; CHECK-NEXT: .long .Ltmp{{.*}}
diff --git a/llvm/test/CodeGen/X86/gcc_except_table.ll b/llvm/test/CodeGen/X86/gcc_except_table.ll
index 82064c2a390..92ea539bcf7 100644
--- a/llvm/test/CodeGen/X86/gcc_except_table.ll
+++ b/llvm/test/CodeGen/X86/gcc_except_table.ll
@@ -18,9 +18,9 @@ define i32 @main() uwtable optsize ssp personality i8* bitcast (i32 (...)* @__gx
; MINGW64: .seh_setframe 5, 32
; MINGW64: callq _Unwind_Resume
; MINGW64: .seh_handlerdata
+; MINGW64: .seh_endproc
; MINGW64: GCC_except_table0:
; MINGW64: Lexception0:
-; MINGW64: .seh_endproc
; MINGW32: .cfi_startproc
; MINGW32: .cfi_personality 0, ___gxx_personality_v0
diff --git a/llvm/test/CodeGen/X86/seh-catch-all.ll b/llvm/test/CodeGen/X86/seh-catch-all.ll
index 1c1a3c2139d..00a2455655b 100644
--- a/llvm/test/CodeGen/X86/seh-catch-all.ll
+++ b/llvm/test/CodeGen/X86/seh-catch-all.ll
@@ -38,6 +38,10 @@ eh.resume:
; CHECK: callq printf
; CHECK: .seh_handlerdata
+; CHECK-NEXT: .text
+; CHECK-NEXT: .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .seh_endproc
+; CHECK-NEXT: .section .xdata,"dr"
; CHECK-NEXT: .long 1
; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL
; CHECK-NEXT: .long .Ltmp{{[0-9]+}}@IMGREL+1
diff --git a/llvm/test/CodeGen/X86/seh-except-finally.ll b/llvm/test/CodeGen/X86/seh-except-finally.ll
index 0630d001bb7..5a529cd8d7a 100644
--- a/llvm/test/CodeGen/X86/seh-except-finally.ll
+++ b/llvm/test/CodeGen/X86/seh-except-finally.ll
@@ -103,6 +103,10 @@ eh.resume: ; preds = %catch.dispatch
; CHECK: retq
;
; CHECK: .seh_handlerdata
+; CHECK-NEXT: .text
+; CHECK-NEXT: .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .seh_endproc
+; CHECK-NEXT: .section .xdata,"dr"
; CHECK-NEXT: .long 3
; CHECK-NEXT: .long .Ltmp0@IMGREL
; CHECK-NEXT: .long .Ltmp1@IMGREL+1
diff --git a/llvm/test/CodeGen/X86/seh-finally.ll b/llvm/test/CodeGen/X86/seh-finally.ll
index 350cd932f48..99f3b658a51 100644
--- a/llvm/test/CodeGen/X86/seh-finally.ll
+++ b/llvm/test/CodeGen/X86/seh-finally.ll
@@ -38,6 +38,10 @@ terminate.lpad: ; preds = %lpad
; X64: retq
; X64: .seh_handlerdata
+; X64-NEXT: .text
+; X64-NEXT: .Ltmp{{[0-9]+}}:
+; X64-NEXT: .seh_endproc
+; X64-NEXT: .section .xdata,"dr"
; X64-NEXT: .long 1
; X64-NEXT: .long .Ltmp0@IMGREL
; X64-NEXT: .long .Ltmp1@IMGREL
diff --git a/llvm/test/CodeGen/X86/seh-safe-div.ll b/llvm/test/CodeGen/X86/seh-safe-div.ll
index 699e58ee8ba..cd0ef717195 100644
--- a/llvm/test/CodeGen/X86/seh-safe-div.ll
+++ b/llvm/test/CodeGen/X86/seh-safe-div.ll
@@ -90,6 +90,10 @@ __try.cont:
; CHECK: jmp [[cont_bb]]
; CHECK: .seh_handlerdata
+; CHECK-NEXT: .text
+; CHECK-NEXT: .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .seh_endproc
+; CHECK-NEXT: .section .xdata,"dr"
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long .Ltmp0@IMGREL
; CHECK-NEXT: .long .Ltmp1@IMGREL+1
diff --git a/llvm/test/CodeGen/X86/win-catchpad-csrs.ll b/llvm/test/CodeGen/X86/win-catchpad-csrs.ll
index c64dcfe058d..6603f4e6d92 100644
--- a/llvm/test/CodeGen/X86/win-catchpad-csrs.ll
+++ b/llvm/test/CodeGen/X86/win-catchpad-csrs.ll
@@ -71,7 +71,8 @@ catchendblock: ; preds = %catch,
; X86: addl $12, %ebp
; X86: jmp [[contbb]]
-; X86: [[catch1bb:LBB0_[0-9]+]]: # %catch{{$}}
+; X86: "?catch$[[catch1bb:[0-9]+]]@?0?try_catch_catch@4HA":
+; X86: LBB0_[[catch1bb]]: # %catch{{$}}
; X86: pushl %ebp
; X86-NOT: pushl
; X86: addl $12, %ebp
@@ -89,7 +90,7 @@ catchendblock: ; preds = %catch,
; X86: .long 0
; X86: .long "??_R0H@8"
; X86: .long 0
-; X86: .long [[catch1bb]]
+; X86: .long "?catch$[[catch1bb]]@?0?try_catch_catch@4HA"
; X64-LABEL: try_catch_catch:
; X64: pushq %rbp
@@ -116,7 +117,8 @@ catchendblock: ; preds = %catch,
; X64: popq %rbp
; X64: retq
-; X64: [[catch1bb:\.LBB0_[0-9]+]]: # %catch{{$}}
+; X64: "?catch$[[catch1bb:[0-9]+]]@?0?try_catch_catch@4HA":
+; X64: LBB0_[[catch1bb]]: # %catch{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
; X64: movq %rdx, %rbp
@@ -132,5 +134,5 @@ catchendblock: ; preds = %catch,
; X64: .long 0
; X64: .long "??_R0H@8"@IMGREL
; X64: .long 0
-; X64: .long [[catch1bb]]@IMGREL
+; X64: .long "?catch$[[catch1bb]]@?0?try_catch_catch@4HA"@IMGREL
; X64: .long 56
diff --git a/llvm/test/CodeGen/X86/win-catchpad.ll b/llvm/test/CodeGen/X86/win-catchpad.ll
index 597f0e8ae80..7af13e67975 100644
--- a/llvm/test/CodeGen/X86/win-catchpad.ll
+++ b/llvm/test/CodeGen/X86/win-catchpad.ll
@@ -78,7 +78,8 @@ catchendblock: ; preds = %catch, %catch.2, %c
; X86: addl $12, %ebp
; X86: jmp [[contbb]]
-; X86: [[catch1bb:LBB0_[0-9]+]]: # %catch{{$}}
+; X86: "?catch$[[catch1bb:[0-9]+]]@?0?try_catch_catch@4HA":
+; X86: LBB0_[[catch1bb]]: # %catch{{$}}
; X86: pushl %ebp
; X86: addl $12, %ebp
; X86: subl $8, %esp
@@ -93,7 +94,8 @@ catchendblock: ; preds = %catch, %catch.2, %c
; X86-NEXT: movl $[[restorebb]], %eax
; X86-NEXT: retl
-; X86: [[catch2bb:LBB0_[0-9]+]]: # %catch.2{{$}}
+; X86: "?catch$[[catch2bb:[0-9]+]]@?0?try_catch_catch@4HA":
+; X86: LBB0_[[catch2bb]]: # %catch.2{{$}}
; X86: pushl %ebp
; X86: addl $12, %ebp
; X86: subl $8, %esp
@@ -112,11 +114,11 @@ catchendblock: ; preds = %catch, %catch.2, %c
; X86-NEXT: .long 0
; X86-NEXT: .long "??_R0H@8"
; X86-NEXT: .long -20
-; X86-NEXT: .long [[catch1bb]]
+; X86-NEXT: .long "?catch$[[catch1bb]]@?0?try_catch_catch@4HA"
; X86-NEXT: .long 64
; X86-NEXT: .long 0
; X86-NEXT: .long 0
-; X86-NEXT: .long [[catch2bb]]
+; X86-NEXT: .long "?catch$[[catch2bb]]@?0?try_catch_catch@4HA"
; X64-LABEL: try_catch_catch:
; X64: Lfunc_begin0:
@@ -135,7 +137,8 @@ catchendblock: ; preds = %catch, %catch.2, %c
; X64: popq %rbp
; X64: retq
-; X64: [[catch1bb:\.LBB0_[0-9]+]]: # %catch{{$}}
+; X64: "?catch$[[catch1bb:[0-9]+]]@?0?try_catch_catch@4HA":
+; X64: LBB0_[[catch1bb]]: # %catch{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
; X64: movq %rdx, %rbp
@@ -149,7 +152,8 @@ catchendblock: ; preds = %catch, %catch.2, %c
; X64-NEXT: leaq [[contbb]](%rip), %rax
; X64-NEXT: retq
-; X64: [[catch2bb:\.LBB0_[0-9]+]]: # %catch.2{{$}}
+; X64: "?catch$[[catch2bb:[0-9]+]]@?0?try_catch_catch@4HA":
+; X64: LBB0_[[catch2bb]]: # %catch.2{{$}}
; X64: movq %rdx, 16(%rsp)
; X64: pushq %rbp
; X64: movq %rdx, %rbp
@@ -187,12 +191,12 @@ catchendblock: ; preds = %catch, %catch.2, %c
; X64-NEXT: .long "??_R0H@8"@IMGREL
; FIXME: This should probably be offset from rsp, not rbp.
; X64-NEXT: .long [[e_addr]]
-; X64-NEXT: .long [[catch1bb]]@IMGREL
+; X64-NEXT: .long "?catch$[[catch1bb]]@?0?try_catch_catch@4HA"@IMGREL
; X64-NEXT: .long 56
; X64-NEXT: .long 64
; X64-NEXT: .long 0
; X64-NEXT: .long 0
-; X64-NEXT: .long [[catch2bb]]@IMGREL
+; X64-NEXT: .long "?catch$[[catch2bb]]@?0?try_catch_catch@4HA"@IMGREL
; X64-NEXT: .long 56
; X64: $ip2state$try_catch_catch:
diff --git a/llvm/test/CodeGen/X86/win-cleanuppad.ll b/llvm/test/CodeGen/X86/win-cleanuppad.ll
index a08fd976fa9..02ead25603f 100644
--- a/llvm/test/CodeGen/X86/win-cleanuppad.ll
+++ b/llvm/test/CodeGen/X86/win-cleanuppad.ll
@@ -65,14 +65,16 @@ cleanup.outer: ; preds = %invoke.cont.1, %c
; X86: movl $3, (%esp)
; X86: calll _f
-; X86: LBB1_[[cleanup_inner:[0-9]+]]: # %cleanup.inner
+; X86: "?dtor$[[cleanup_inner:[0-9]+]]@?0?nested_cleanup@4HA":
+; X86: LBB1_[[cleanup_inner]]: # %cleanup.inner{{$}}
; X86: pushl %ebp
; X86: leal {{.*}}(%ebp), %ecx
; X86: calll "??1Dtor@@QAE@XZ"
; X86: popl %ebp
; X86: retl
-; X86: LBB1_[[cleanup_outer:[0-9]+]]: # %cleanup.outer
+; X86: "?dtor$[[cleanup_outer:[0-9]+]]@?0?nested_cleanup@4HA":
+; X86: LBB1_[[cleanup_outer]]: # %cleanup.outer{{$}}
; X86: pushl %ebp
; X86: leal {{.*}}(%ebp), %ecx
; X86: calll "??1Dtor@@QAE@XZ"
@@ -91,41 +93,46 @@ cleanup.outer: ; preds = %invoke.cont.1, %c
; X86: .long 1
; X86: $stateUnwindMap$nested_cleanup:
; X86: .long -1
-; X86: .long LBB1_[[cleanup_outer]]
+; X86: .long "?dtor$[[cleanup_outer]]@?0?nested_cleanup@4HA"
; X86: .long 0
-; X86: .long LBB1_[[cleanup_inner]]
+; X86: .long "?dtor$[[cleanup_inner]]@?0?nested_cleanup@4HA"
; X64-LABEL: nested_cleanup:
; X64: .Lfunc_begin1:
-; X64: .Ltmp8:
+; X64: .Ltmp14:
; X64: movl $1, %ecx
; X64: callq f
-; X64: .Ltmp10:
+; X64: .Ltmp16:
; X64: movl $2, %ecx
; X64: callq f
-; X64: .Ltmp11:
+; X64: .Ltmp17:
; X64: callq "??1Dtor@@QAE@XZ"
-; X64: .Ltmp12:
+; X64: .Ltmp18:
; X64: movl $3, %ecx
; X64: callq f
-; X64: .Ltmp13:
+; X64: .Ltmp19:
-; X64: .LBB1_[[cleanup_inner:[0-9]+]]: # %cleanup.inner
+; X64: "?dtor$[[cleanup_inner:[0-9]+]]@?0?nested_cleanup@4HA":
+; X64: LBB1_[[cleanup_inner]]: # %cleanup.inner{{$}}
; X64: pushq %rbp
; X64: leaq {{.*}}(%rbp), %rcx
; X64: callq "??1Dtor@@QAE@XZ"
; X64: popq %rbp
; X64: retq
-; X64: .LBB1_[[cleanup_outer:[0-9]+]]: # %cleanup.outer
+; X64: .seh_handlerdata
+; X64: .text
+; X64: .seh_endproc
+
+; X64: "?dtor$[[cleanup_outer:[0-9]+]]@?0?nested_cleanup@4HA":
+; X64: LBB1_[[cleanup_outer]]: # %cleanup.outer{{$}}
; X64: pushq %rbp
; X64: leaq {{.*}}(%rbp), %rcx
; X64: callq "??1Dtor@@QAE@XZ"
; X64: popq %rbp
; X64: retq
-; X64: .seh_handlerdata
-; X64-NEXT: .long ($cppxdata$nested_cleanup)@IMGREL
+; X64: .section .xdata,"dr"
; X64-NEXT: .align 4
; X64: $cppxdata$nested_cleanup:
; X64-NEXT: .long 429065506
@@ -141,20 +148,20 @@ cleanup.outer: ; preds = %invoke.cont.1, %c
; X64: $stateUnwindMap$nested_cleanup:
; X64-NEXT: .long -1
-; X64-NEXT: .long .LBB1_[[cleanup_outer]]@IMGREL
+; X64-NEXT: .long "?dtor$[[cleanup_outer]]@?0?nested_cleanup@4HA"@IMGREL
; X64-NEXT: .long 0
-; X64-NEXT: .long .LBB1_[[cleanup_inner]]@IMGREL
+; X64-NEXT: .long "?dtor$[[cleanup_inner]]@?0?nested_cleanup@4HA"@IMGREL
; X64: $ip2state$nested_cleanup:
; X64-NEXT: .long .Lfunc_begin1@IMGREL
; X64-NEXT: .long -1
-; X64-NEXT: .long .Ltmp8@IMGREL
+; X64-NEXT: .long .Ltmp14@IMGREL
; X64-NEXT: .long 0
-; X64-NEXT: .long .Ltmp10@IMGREL
+; X64-NEXT: .long .Ltmp16@IMGREL
; X64-NEXT: .long 1
-; X64-NEXT: .long .Ltmp12@IMGREL
+; X64-NEXT: .long .Ltmp18@IMGREL
; X64-NEXT: .long 0
-; X64-NEXT: .long .Ltmp13@IMGREL+1
+; X64-NEXT: .long .Ltmp19@IMGREL+1
; X64-NEXT: .long -1
attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
diff --git a/llvm/test/CodeGen/X86/win-funclet-cfi.ll b/llvm/test/CodeGen/X86/win-funclet-cfi.ll
new file mode 100644
index 00000000000..30883791d8e
--- /dev/null
+++ b/llvm/test/CodeGen/X86/win-funclet-cfi.ll
@@ -0,0 +1,100 @@
+; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define void @"\01?f@@YAXXZ"(i1 %B) personality i32 (...)* @__CxxFrameHandler3 {
+entry:
+ invoke void @g()
+ to label %unreachable unwind label %cleanupblock
+
+cleanupblock:
+ %cleanp = cleanuppad []
+ call void @g()
+ cleanupret %cleanp unwind label %catch.dispatch
+
+catch.dispatch:
+ %cp = catchpad [i8* null, i32 64, i8* null]
+ to label %catch unwind label %catchendblock
+
+catch:
+ call void @g()
+ catchret %cp to label %try.cont
+
+try.cont:
+ ret void
+
+catchendblock:
+ catchendpad unwind to caller
+
+unreachable:
+ unreachable
+}
+
+
+declare void @g()
+
+declare i32 @__CxxFrameHandler3(...)
+
+; Destructors need CFI but they shouldn't use the .seh_handler directive.
+; CHECK: "?dtor$[[cleanup:[0-9]+]]@?0??f@@YAXXZ@4HA":
+; CHECK: .seh_proc "?dtor$[[cleanup]]@?0??f@@YAXXZ@4HA"
+; CHECK-NOT: .seh_handler __CxxFrameHandler3
+; CHECK: LBB0_[[cleanup]]: # %cleanupblock{{$}}
+
+; Emit CFI for pushing RBP.
+; CHECK: movq %rdx, 16(%rsp)
+; CHECK: pushq %rbp
+; CHECK: .seh_pushreg 5
+
+; Emit CFI for allocating from the stack pointer.
+; CHECK: subq $32, %rsp
+; CHECK: .seh_stackalloc 32
+
+; FIXME: This looks wrong...
+; CHECK: leaq 32(%rsp), %rbp
+; CHECK: .seh_setframe 5, 32
+
+; Prologue is done, emit the .seh_endprologue directive.
+; CHECK: .seh_endprologue
+
+; Make sure there is a nop after a call if the call precedes the epilogue.
+; CHECK: callq g
+; CHECK-NEXT: nop
+
+; Don't emit a reference to the LSDA.
+; CHECK: .seh_handlerdata
+; CHECK-NOT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
+; CHECK-NEXT: .text
+; CHECK: .seh_endproc
+
+; CHECK: "?catch$[[catch:[0-9]+]]@?0??f@@YAXXZ@4HA":
+; CHECK: .seh_proc "?catch$[[catch]]@?0??f@@YAXXZ@4HA"
+; CHECK-NEXT: .seh_handler __CxxFrameHandler3, @unwind, @except
+; CHECK: LBB0_[[catch]]: # %catch{{$}}
+
+; Emit CFI for pushing RBP.
+; CHECK: movq %rdx, 16(%rsp)
+; CHECK: pushq %rbp
+; CHECK: .seh_pushreg 5
+
+; Emit CFI for allocating from the stack pointer.
+; CHECK: subq $32, %rsp
+; CHECK: .seh_stackalloc 32
+
+; FIXME: This looks wrong...
+; CHECK: leaq 32(%rsp), %rbp
+; CHECK: .seh_setframe 5, 32
+
+; Prologue is done, emit the .seh_endprologue directive.
+; CHECK: .seh_endprologue
+
+; Make sure there is a nop after a call if the call precedes the epilogue.
+; CHECK: callq g
+; CHECK-NEXT: nop
+
+; Emit a reference to the LSDA.
+; CHECK: .seh_handlerdata
+; CHECK-NEXT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
+; CHECK-NEXT: .text
+; CHECK: .seh_endproc
OpenPOWER on IntegriCloud