File: 2008-08-31-EH_RETURN32.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (60 lines) | stat: -rw-r--r-- 1,903 bytes parent folder | download | duplicates (7)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc -mcpu=corei7 < %s -verify-machineinstrs | FileCheck %s

target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
target triple = "i386-pc-linux"

; Check that eh_return & unwind_init were properly lowered

define ptr @test1(i32 %a, ptr %b) nounwind {
; CHECK-LABEL: test1:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushl %ebp
; CHECK-NEXT:    movl %esp, %ebp
; CHECK-NEXT:    pushl %ebx
; CHECK-NEXT:    pushl %edi
; CHECK-NEXT:    pushl %esi
; CHECK-NEXT:    pushl %edx
; CHECK-NEXT:    pushl %eax
; CHECK-NEXT:    pushl %eax
; CHECK-NEXT:    movl 12(%ebp), %ecx
; CHECK-NEXT:    movl 8(%ebp), %eax
; CHECK-NEXT:    movl %ecx, 4(%ebp,%eax)
; CHECK-NEXT:    leal 4(%ebp,%eax), %ecx
; CHECK-NEXT:    addl $4, %esp
; CHECK-NEXT:    popl %eax
; CHECK-NEXT:    popl %edx
; CHECK-NEXT:    popl %esi
; CHECK-NEXT:    popl %edi
; CHECK-NEXT:    popl %ebx
; CHECK-NEXT:    popl %ebp
; CHECK-NEXT:    movl %ecx, %esp
; CHECK-NEXT:    retl # eh_return, addr: %ecx
entry:
  call void @llvm.eh.unwind.init()
  %foo   = alloca i32
  call void @llvm.eh.return.i32(i32 %a, ptr %b)
  unreachable
}

define ptr @test2(i32 %a, ptr %b) nounwind {
; CHECK-LABEL: test2:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushl %ebp
; CHECK-NEXT:    movl %esp, %ebp
; CHECK-NEXT:    pushl %eax
; CHECK-NEXT:    movl 12(%ebp), %ecx
; CHECK-NEXT:    movl 8(%ebp), %eax
; CHECK-NEXT:    movl %ecx, 4(%ebp,%eax)
; CHECK-NEXT:    leal 4(%ebp,%eax), %ecx
; CHECK-NEXT:    popl %eax
; CHECK-NEXT:    popl %ebp
; CHECK-NEXT:    movl %ecx, %esp
; CHECK-NEXT:    retl # eh_return, addr: %ecx
entry:
  call void @llvm.eh.return.i32(i32 %a, ptr %b)
  unreachable
}

declare void @llvm.eh.return.i32(i32, ptr)
declare void @llvm.eh.unwind.init()