1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[update_llc_test_checks] Support Windows .seh_proc for x86

This commit is contained in:
Fangrui Song 2020-12-30 12:32:46 -08:00
parent 26db8e9958
commit e9c67e8f20
3 changed files with 39 additions and 1 deletions

View File

@ -4,6 +4,9 @@
;; Check that we accept .Ldsolocal$local: below the function label.
; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
;; Check that we accept .seh_proc below the function label.
; RUN: llc -mtriple=x86_64-windows -relocation-model=pic < %s | FileCheck %s --check-prefix=WIN
define hidden i32 @"_Z54bar$ompvariant$bar"() {
entry:
ret i32 2
@ -11,5 +14,8 @@ entry:
define dso_local i32 @dsolocal() {
entry:
call void @ext()
ret i32 2
}
declare void @ext()

View File

@ -5,6 +5,9 @@
;; Check that we accept .Ldsolocal$local: below the function label.
; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
;; Check that we accept .seh_proc below the function label.
; RUN: llc -mtriple=x86_64-windows -relocation-model=pic < %s | FileCheck %s --check-prefix=WIN
define hidden i32 @"_Z54bar$ompvariant$bar"() {
; CHECK-LABEL: _Z54bar$ompvariant$bar:
; CHECK: # %bb.0: # %entry
@ -15,6 +18,11 @@ define hidden i32 @"_Z54bar$ompvariant$bar"() {
; PIC: # %bb.0: # %entry
; PIC-NEXT: movl $2, %eax
; PIC-NEXT: retq
;
; WIN-LABEL: _Z54bar$ompvariant$bar:
; WIN: # %bb.0: # %entry
; WIN-NEXT: movl $2, %eax
; WIN-NEXT: retq
entry:
ret i32 2
}
@ -22,13 +30,37 @@ entry:
define dso_local i32 @dsolocal() {
; CHECK-LABEL: dsolocal:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: pushq %rax
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: callq ext@PLT
; CHECK-NEXT: movl $2, %eax
; CHECK-NEXT: popq %rcx
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: retq
;
; PIC-LABEL: dsolocal:
; PIC: # %bb.0: # %entry
; PIC-NEXT: pushq %rax
; PIC-NEXT: .cfi_def_cfa_offset 16
; PIC-NEXT: callq ext@PLT
; PIC-NEXT: movl $2, %eax
; PIC-NEXT: popq %rcx
; PIC-NEXT: .cfi_def_cfa_offset 8
; PIC-NEXT: retq
;
; WIN-LABEL: dsolocal:
; WIN: # %bb.0: # %entry
; WIN-NEXT: subq $40, %rsp
; WIN-NEXT: .seh_stackalloc 40
; WIN-NEXT: .seh_endprologue
; WIN-NEXT: callq ext
; WIN-NEXT: movl $2, %eax
; WIN-NEXT: addq $40, %rsp
; WIN-NEXT: retq
; WIN-NEXT: .seh_endproc
entry:
call void @ext()
ret i32 2
}
declare void @ext()

View File

@ -17,7 +17,7 @@ else:
ASM_FUNCTION_X86_RE = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*(@"?(?P=func)"?| -- Begin function (?P=func))\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?'
r'(?:\.L[^$]+\$local:\n)?' # drop .L<func>$local:
r'(?:[ \t]+.cfi_startproc\n)?' # drop optional cfi noise
r'(?:[ \t]+.cfi_startproc\n|.seh_proc[^\n]+\n)?' # drop optional cfi
r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
r'^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.comm|\.(?:sub)?section|#+ -- End function)',
flags=(re.M | re.S))