reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
; RUN: llc -mtriple=x86_64-pc-windows-msvc -mattr=+avx < %s | FileCheck %s

; void bar(int a, int b, int c, int d, int e);
; void baz(int x);
; 
; void foo(int a, int b, int c, int d, int e)
; {
;   __asm("nop" ::: "bx", "cx", "xmm5", "xmm6", "ymm7");
;   try {
;     bar(a, b, c, d, e);
;   }
;   catch (...) {
;     baz(a);
;     if (a)
;       __asm("nop" ::: "xmm8");
;   }
; }

%rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }

$"??_R0H@8" = comdat any

@"??_7type_info@@6B@" = external constant i8*
@"??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat

declare dso_local i32 @__CxxFrameHandler3(...)
declare dso_local void @"?bar@@YAXHHHHH@Z"(i32, i32, i32, i32, i32)
declare dso_local void @"?baz@@YAXH@Z"(i32)

define dso_local void @"?foo@@YAXHHHHH@Z"(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
entry:
  %e.addr = alloca i32, align 4
  %d.addr = alloca i32, align 4
  %c.addr = alloca i32, align 4
  %b.addr = alloca i32, align 4
  %a.addr = alloca i32, align 4
  store i32 %e, i32* %e.addr, align 4
  store i32 %d, i32* %d.addr, align 4
  store i32 %c, i32* %c.addr, align 4
  store i32 %b, i32* %b.addr, align 4
  store i32 %a, i32* %a.addr, align 4
  call void asm sideeffect "nop", "~{bx},~{cx},~{xmm5},~{xmm6},~{ymm7}"()
  %0 = load i32, i32* %e.addr, align 4
  %1 = load i32, i32* %d.addr, align 4
  %2 = load i32, i32* %c.addr, align 4
  %3 = load i32, i32* %b.addr, align 4
  %4 = load i32, i32* %a.addr, align 4
  invoke void @"?bar@@YAXHHHHH@Z"(i32 %4, i32 %3, i32 %2, i32 %1, i32 %0)
          to label %invoke.cont unwind label %catch.dispatch

catch.dispatch:                                   ; preds = %entry
  %5 = catchswitch within none [label %catch] unwind to caller

catch:                                            ; preds = %catch.dispatch
  %6 = catchpad within %5 [i8* null, i32 64, i8* null]
  %7 = load i32, i32* %a.addr, align 4
  call void @"?baz@@YAXH@Z"(i32 %7) [ "funclet"(token %6) ]
  %8 = load i32, i32* %a.addr, align 4
  %tobool = icmp ne i32 %8, 0
  br i1 %tobool, label %if.then, label %if.end

if.then:                                          ; preds = %catch
  call void asm sideeffect "nop", "~{xmm8}"() [ "funclet"(token %6) ]
  br label %if.end

invoke.cont:                                      ; preds = %entry
  br label %try.cont

if.end:                                           ; preds = %if.then, %catch
  catchret from %6 to label %catchret.dest

catchret.dest:                                    ; preds = %if.end
  br label %try.cont

try.cont:                                         ; preds = %catchret.dest, %invoke.cont
  ret void
}

; CHECK: # %catch
; CHECK: movq    %rdx, 16(%rsp)
; CHECK: pushq   %rbp
; CHECK: .seh_pushreg %rbp
; CHECK: pushq   %rbx
; CHECK: .seh_pushreg %rbx
; CHECK: subq    $88, %rsp
; CHECK: .seh_stackalloc 88
; CHECK: leaq    112(%rdx), %rbp
; CHECK: vmovaps %xmm8, 48(%rsp)
; CHECK: .seh_savexmm %xmm8, 48
; CHECK: vmovaps %xmm7, 64(%rsp)
; CHECK: .seh_savexmm %xmm7, 64
; CHECK: vmovaps %xmm6, 80(%rsp)
; CHECK: .seh_savexmm %xmm6, 80
; CHECK: .seh_endprologue
; CHECK: movl   -{{[0-9]+}}(%rbp), %ecx
; CHECK: vmovaps 80(%rsp), %xmm6
; CHECK: vmovaps 64(%rsp), %xmm7
; CHECK: vmovaps 48(%rsp), %xmm8
; CHECK: leaq    .LBB0_1(%rip), %rax
; CHECK: addq    $88, %rsp
; CHECK: popq    %rbx
; CHECK: popq    %rbp
; CHECK: retq # CATCHRET

; CHECK-LABEL: "$handlerMap$0$?foo@@YAXHHHHH@Z":
; CHECK-NEXT: .long   64                      # Adjectives
; CHECK-NEXT: .long   0                       # Type
; CHECK-NEXT: .long   0                       # CatchObjOffset
; CHECK-NEXT: .long   "?catch$2@?0??foo@@YAXHHHHH@Z@4HA"@IMGREL # Handler
; Sum of:
;   16 RDX store offset
;   16 two pushes
;   72 stack alloc
; CHECK-NEXT: .long   120                     # ParentFrameOffset