File: indirect-branch-tracking-eh.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (94 lines) | stat: -rw-r--r-- 3,194 bytes parent folder | download | duplicates (8)
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
; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s --check-prefix=X86_64
; RUN: llc -mtriple=i386-unknown-unknown < %s | FileCheck %s --check-prefix=X86
; RUN: llc -mtriple i386-windows-gnu -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=SJLJ
; RUN: llc -mtriple i386-windows-gnu -exception-model sjlj -verify-machineinstrs=0 < %s | FileCheck %s --check-prefix=NUM

; X86_64:       test_eh:                                # @test_eh
; X86_64-NEXT:  .Lfunc_begin0:
; X86_64:       # %bb.0:                                # %entry
; X86_64-NEXT:          endbr64
; X86_64-NEXT:          pushq   %rax
; X86_64:       .Ltmp0:
; X86_64-NEXT:          callq   _Z20function_that_throwsv
; X86_64-NEXT:  .Ltmp1:
; X86_64-NEXT:  # %bb.1:                                # %try.cont
; X86_64:               retq
; X86_64-NEXT:  .LBB0_2:                                # %lpad
; X86_64-NEXT:          .cfi_def_cfa_offset 16
; X86_64-NEXT:  .Ltmp2:
; X86_64-NEXT:          endbr64
; X86_64:               callq   __cxa_begin_catch


; X86:       test_eh:                                # @test_eh
; X86-NEXT:  .Lfunc_begin0:
; X86:       # %bb.0:                                # %entry
; X86-NEXT:          endbr32
; X86-NEXT:  .Ltmp0:
; X86:               calll   _Z20function_that_throwsv
; X86-NEXT:  .Ltmp1:
; X86-NEXT:  # %bb.1:                                # %try.cont
; X86-NEXT:          retl
; X86-NEXT:  .LBB0_2:                                # %lpad
; X86-NEXT:  .Ltmp2:
; X86-NEXT:          endbr32
; X86:               calll   __cxa_begin_catch

; NUM-COUNT-3: endbr32

; SJLJ:       test_eh:
; SJLJ-NEXT:  Lfunc_begin0:
; SJLJ-NEXT:  # %bb.0:                                # %entry
; SJLJ-NEXT:          endbr32
; SJLJ:               calll   __Unwind_SjLj_Register
; SJLJ:       Ltmp0:
; SJLJ:               calll   __Z20function_that_throwsv
; SJLJ:       LBB0_2:                                 # %try.cont
; SJLJ:               calll   __Unwind_SjLj_Unregister
; SJLJ:               retl

; SJLJ:       LBB0_3:
; SJLJ-NEXT:          endbr32
; SJLJ-NEXT:          leal
; SJLJ-NEXT:          movl
; SJLJ-NEXT:          cmpl
; SJLJ-NEXT:          jb      LBB0_4

; SJLJ:       LBB0_4:
; SJLJ-NEXT:          jmpl    *LJTI0_0(,%eax,4)

; SJLJ:       LBB0_6:                                 # %lpad
; SJLJ-NEXT:  Ltmp2:
; SJLJ-NEXT:          endbr32
; SJLJ:               calll   ___cxa_begin_catch
; SJLJ:               jmp     LBB0_2
; SJLJ:       LJTI0_0:
; SJLJ-NEXT:          .long   LBB0_6



declare void @_Z20function_that_throwsv()
declare i32 @__gxx_personality_sj0(...)
declare i8* @__cxa_begin_catch(i8*)
declare void @__cxa_end_catch()

define void @test_eh() personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
entry:
  invoke void @_Z20function_that_throwsv()
          to label %try.cont unwind label %lpad

lpad:
  %0 = landingpad { i8*, i32 }
          catch i8* null
  %1 = extractvalue { i8*, i32 } %0, 0
  %2 = tail call i8* @__cxa_begin_catch(i8* %1)
  tail call void @__cxa_end_catch()
  br label %try.cont

try.cont:
  ret void
}

!llvm.module.flags = !{!0}

!0 = !{i32 4, !"cf-protection-branch", i32 1}