File: gcc_except_table_functions.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (54 lines) | stat: -rw-r--r-- 1,430 bytes parent folder | download | duplicates (13)
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
; RUN: llc -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s

; This test demonstrates that it is possible to use functions for typeinfo
; instead of global variables. While __gxx_personality_v0 would never know what
; to do with them, other EH schemes such as SEH might use them.

declare i32 @__gxx_personality_v0(...)
declare void @filt0()
declare void @filt1()
declare void @_Z1fv()
declare i32 @llvm.eh.typeid.for(ptr)

define i32 @main() uwtable personality ptr @__gxx_personality_v0 {
entry:
  invoke void @_Z1fv()
          to label %try.cont unwind label %lpad

try.cont:
  ret i32 0

lpad:
  %0 = landingpad { ptr, i32 }
          cleanup
          catch ptr @filt0
          catch ptr @filt1
  %sel = extractvalue { ptr, i32 } %0, 1
  %id0 = call i32 @llvm.eh.typeid.for(ptr @filt0)
  %is_f0 = icmp eq i32 %sel, %id0
  br i1 %is_f0, label %try.cont, label %check_f1

check_f1:
  %id1 = call i32 @llvm.eh.typeid.for(ptr @filt1)
  %is_f1 = icmp eq i32 %sel, %id1
  br i1 %is_f1, label %try.cont, label %eh.resume

eh.resume:
  resume { ptr, i32 } %0
}

; CHECK-LABEL: main:
; CHECK: .cfi_startproc
; CHECK: .cfi_personality 3, __gxx_personality_v0
; CHECK: .cfi_lsda 3, .Lexception0
; CHECK: .cfi_def_cfa_offset 16
; CHECK: callq _Z1fv
; CHECK: retq
; CHECK: cmpl $2, %edx
; CHECK: je
; CHECK: cmpl $1, %edx
; CHECK: je
; CHECK: callq _Unwind_Resume
; CHECK: .cfi_endproc
; CHECK: GCC_except_table0:
; CHECK: Lexception0: