Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -stack-symbol-ordering=0 < %s | FileCheck %s
      2 
      3 ; The aligned alloca means that we have to realign the stack, which forces the
      4 ; use of ESI to address local variables.
      5 
      6 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
      7 target triple = "i686--windows-msvc"
      8 
      9 ; Function Attrs: nounwind
     10 define void @realigned_try() personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) {
     11 entry:
     12   %x = alloca [4 x i32], align 16
     13   %arrayidx = getelementptr inbounds [4 x i32], [4 x i32]* %x, i32 0, i32 0
     14   invoke void @useit(i32* %arrayidx)
     15           to label %__try.cont unwind label %catch.dispatch
     16 
     17 catch.dispatch:                                   ; preds = %entry
     18   %cs1 = catchswitch within none [label %__except.ret] unwind to caller
     19 
     20 __except.ret:                                     ; preds = %catch.dispatch
     21   %pad = catchpad within %cs1 [i8* bitcast (i32 ()* @"\01?filt$0@0@realigned_try@@" to i8*)]
     22   catchret from %pad to label %__try.cont
     23 
     24 __try.cont:                                       ; preds = %entry, %__except.ret
     25   ret void
     26 }
     27 
     28 ; Function Attrs: nounwind argmemonly
     29 
     30 ; Function Attrs: nounwind
     31 define internal i32 @"\01?filt$0@0@realigned_try@@"() {
     32 entry:
     33   ret i32 1
     34 }
     35 
     36 declare void @useit(i32*)
     37 
     38 declare i32 @_except_handler3(...)
     39 
     40 ; CHECK-LABEL: _realigned_try:
     41 ; Prologue
     42 ; CHECK: pushl   %ebp
     43 ; CHECK: movl    %esp, %ebp
     44 ; CHECK: pushl   %ebx
     45 ; CHECK: pushl   %edi
     46 ; CHECK: pushl   %esi
     47 ; CHECK: andl    $-16, %esp
     48 ; CHECK: subl    $64, %esp
     49 ; CHECK: movl    %esp, %esi
     50 ; Spill EBP
     51 ; CHECK: movl    %ebp, 12(%esi)
     52 ; Spill ESP
     53 ; CHECK: movl    %esp, 36(%esi)
     54 ; The state is stored at ESI+56, the end of the node is ESI+60.
     55 ; CHECK: movl    $-1, 56(%esi)
     56 ;
     57 ; __try
     58 ; CHECK: calll _useit
     59 ;
     60 ; Epilogue
     61 ; CHECK: LBB0_2:       # %__try.cont
     62 ; CHECK: leal    -12(%ebp), %esp
     63 ; CHECK: popl    %esi
     64 ; CHECK: popl    %edi
     65 ; CHECK: popl    %ebx
     66 ; CHECK: popl    %ebp
     67 ; CHECK: retl
     68 ;
     69 ; CHECK: LBB0_1:                                 # %__except.ret
     70 ; Restore ESP
     71 ; CHECK: movl    -24(%ebp), %esp
     72 ; Recompute ESI by subtracting 60 from the end of the registration node.
     73 ; CHECK: leal    -60(%ebp), %esi
     74 ; Restore EBP
     75 ; CHECK: movl    12(%esi), %ebp
     76 ; Rejoin normal control flow
     77 ; CHECK: jmp     LBB0_2
     78