Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck %s
      2 
      3 %Iter = type { i32, i32, i32 }
      4 
      5 %frame.reverse = type { %Iter, %Iter }
      6 
      7 declare i32 @pers(...)
      8 declare void @llvm.stackrestore(i8*)
      9 declare i8* @llvm.stacksave()
     10 declare void @begin(%Iter* sret)
     11 declare void @plus(%Iter* sret, %Iter*, i32)
     12 declare void @reverse(%frame.reverse* inalloca align 4)
     13 
     14 define i32 @main() personality i32 (...)* @pers {
     15   %temp.lvalue = alloca %Iter
     16   br label %blah
     17 
     18 blah:
     19   %inalloca.save = call i8* @llvm.stacksave()
     20   %rev_args = alloca inalloca %frame.reverse, align 4
     21   %beg = getelementptr %frame.reverse, %frame.reverse* %rev_args, i32 0, i32 0
     22   %end = getelementptr %frame.reverse, %frame.reverse* %rev_args, i32 0, i32 1
     23 
     24 ; CHECK:  calll   __chkstk
     25 ; CHECK:  movl %esp, %[[beg:[^ ]*]]
     26 ; CHECK:  leal 12(%[[beg]]), %[[end:[^ ]*]]
     27 
     28   call void @begin(%Iter* sret %temp.lvalue)
     29 ; CHECK:  calll _begin
     30 
     31   invoke void @plus(%Iter* sret %end, %Iter* %temp.lvalue, i32 4)
     32           to label %invoke.cont unwind label %lpad
     33 
     34 ;  Uses end as sret param.
     35 ; CHECK:  pushl %[[end]]
     36 ; CHECK:  calll _plus
     37 
     38 invoke.cont:
     39   call void @begin(%Iter* sret %beg)
     40 
     41 ; CHECK:  pushl %[[beg]]
     42 ; CHECK:  calll _begin
     43 
     44   invoke void @reverse(%frame.reverse* inalloca align 4 %rev_args)
     45           to label %invoke.cont5 unwind label %lpad
     46 
     47 invoke.cont5:                                     ; preds = %invoke.cont
     48   call void @llvm.stackrestore(i8* %inalloca.save)
     49   ret i32 0
     50 
     51 lpad:                                             ; preds = %invoke.cont, %entry
     52   %lp = landingpad { i8*, i32 }
     53           cleanup
     54   unreachable
     55 }
     56