File: windows-seh-EHa-CppDtors01.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 (255 lines) | stat: -rw-r--r-- 12,079 bytes parent folder | download | duplicates (3)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
; RUN: llc -verify-machineinstrs < %s | FileCheck %s

; CHECK-LABEL: "$cppxdata$?crash@@YAXH@Z":
; CHECK:	.long	("$stateUnwindMap$?crash@@YAXH@Z")
; CHECK:	.long	("$ip2state$?crash@@YAXH@Z")

; CHECK-LABEL: "$stateUnwindMap$?crash@@YAXH@Z":
; CHECK:	.long	-1 
; CHECK:	.long	"?dtor$
; CHECK:	.long	0 
; CHECK:	.long	"?dtor$
; CHECK:	.long	1
; CHECK:	.long	"?dtor$

; CHECK-LABEL: "$ip2state$?crash@@YAXH@Z":
; CHECK-NEXT:	.long	.Lfunc_begin0@IMGREL
; CHECK-NEXT:	.long	-1                  
; CHECK-NEXT:	.long	.Ltmp     
; CHECK-NEXT:	.long	0                   
; CHECK-NEXT:	.long	.Ltmp     
; CHECK-NEXT:	.long	1                   
; CHECK-NEXT:	.long	.Ltmp
; CHECK-NEXT:	.long	2                   
; CHECK-NEXT:	.long	.Ltmp
; CHECK-NEXT:	.long	1                   
; CHECK-NEXT:	.long	.Ltmp
; CHECK-NEXT:	.long	0                   
; CHECK-NEXT:	.long	.Ltmp
; CHECK-NEXT:	.long	-1                  

; ModuleID = 'windows-seh-EHa-CppDtors01.cpp'
source_filename = "windows-seh-EHa-CppDtors01.cpp"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-windows-msvc"

%struct.A = type { i8 }
%struct.B = type { i8 }
%struct.C = type { i8 }

$"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@" = comdat any

$"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@" = comdat any

$"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@" = comdat any

$"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = comdat any

@"?g@@3HA" = dso_local global i32 0, align 4
@"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@" = linkonce_odr dso_local unnamed_addr constant [44 x i8] c" Test CPP unwind: in catch handler i = %d \0A\00", comdat, align 1
@"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in C dtor \0A\00", comdat, align 1
@"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in B dtor \0A\00", comdat, align 1
@"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i8] c" in A dtor \0A\00", comdat, align 1

; Function Attrs: noinline optnone
define dso_local void @"?crash@@YAXH@Z"(i32 %i) #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
entry:
  %i.addr = alloca i32, align 4
  %ObjA = alloca %struct.A, align 1
  %ObjB = alloca %struct.B, align 1
  %ObjC = alloca %struct.C, align 1
  store i32 %i, i32* %i.addr, align 4
  invoke void @llvm.seh.scope.begin()
          to label %invoke.cont unwind label %ehcleanup13

invoke.cont:                                      ; preds = %entry
  %0 = load i32, i32* %i.addr, align 4
  %cmp = icmp eq i32 %0, 0
  br i1 %cmp, label %if.then, label %if.end

if.then:                                          ; preds = %invoke.cont
  store volatile i32 0, i32* inttoptr (i64 17 to i32*), align 4
  br label %if.end

if.end:                                           ; preds = %if.then, %invoke.cont
  invoke void @llvm.seh.scope.begin()
          to label %invoke.cont1 unwind label %ehcleanup11

invoke.cont1:                                     ; preds = %if.end
  %1 = load i32, i32* %i.addr, align 4
  %cmp2 = icmp eq i32 %1, 1
  br i1 %cmp2, label %if.then3, label %if.end4

if.then3:                                         ; preds = %invoke.cont1
  store volatile i32 0, i32* inttoptr (i64 17 to i32*), align 4
  br label %if.end4

if.end4:                                          ; preds = %if.then3, %invoke.cont1
  invoke void @llvm.seh.scope.begin()
          to label %invoke.cont5 unwind label %ehcleanup

invoke.cont5:                                     ; preds = %if.end4
  %2 = load i32, i32* %i.addr, align 4
  %cmp6 = icmp eq i32 %2, 2
  br i1 %cmp6, label %if.then7, label %if.end8

if.then7:                                         ; preds = %invoke.cont5
  store volatile i32 0, i32* inttoptr (i64 17 to i32*), align 4
  br label %if.end8

if.end8:                                          ; preds = %if.then7, %invoke.cont5
  invoke void @llvm.seh.scope.end()
          to label %invoke.cont9 unwind label %ehcleanup

invoke.cont9:                                     ; preds = %if.end8
  call void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.C* %ObjC) #6
  invoke void @llvm.seh.scope.end()
          to label %invoke.cont10 unwind label %ehcleanup11

invoke.cont10:                                    ; preds = %invoke.cont9
  call void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.B* %ObjB) #6
  invoke void @llvm.seh.scope.end()
          to label %invoke.cont12 unwind label %ehcleanup13

invoke.cont12:                                    ; preds = %invoke.cont10
  call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* %ObjA) #6
  ret void

ehcleanup:                                        ; preds = %if.end8, %if.end4
  %3 = cleanuppad within none []
  call void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.C* %ObjC) #6 [ "funclet"(token %3) ]
  cleanupret from %3 unwind label %ehcleanup11

ehcleanup11:                                      ; preds = %invoke.cont9, %ehcleanup, %if.end
  %4 = cleanuppad within none []
  call void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.B* %ObjB) #6 [ "funclet"(token %4) ]
  cleanupret from %4 unwind label %ehcleanup13

ehcleanup13:                                      ; preds = %invoke.cont10, %ehcleanup11, %entry
  %5 = cleanuppad within none []
  call void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* %ObjA) #6 [ "funclet"(token %5) ]
  cleanupret from %5 unwind to caller
}

; Function Attrs: nounwind readnone
declare dso_local void @llvm.seh.scope.begin() #1

declare dso_local i32 @__CxxFrameHandler3(...)

; Function Attrs: nounwind readnone
declare dso_local void @llvm.seh.scope.end() #1

; Function Attrs: noinline nounwind optnone
define internal void @"??1C@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.C* %this) unnamed_addr #2 align 2 {
entry:
  %this.addr = alloca %struct.C*, align 8
  store %struct.C* %this, %struct.C** %this.addr, align 8
  %this1 = load %struct.C*, %struct.C** %this.addr, align 8
  call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @"??_C@_0N@FCCEEGKL@?5in?5C?5dtor?5?6?$AA@", i64 0, i64 0))
  ret void
}

; Function Attrs: noinline nounwind optnone
define internal void @"??1B@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.B* %this) unnamed_addr #2 align 2 {
entry:
  %this.addr = alloca %struct.B*, align 8
  store %struct.B* %this, %struct.B** %this.addr, align 8
  %this1 = load %struct.B*, %struct.B** %this.addr, align 8
  call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @"??_C@_0N@EFFPFCOI@?5in?5B?5dtor?5?6?$AA@", i64 0, i64 0))
  ret void
}

; Function Attrs: noinline nounwind optnone
define internal void @"??1A@?1??crash@@YAXH@Z@QEAA@XZ"(%struct.A* %this) unnamed_addr #2 align 2 {
entry:
  %this.addr = alloca %struct.A*, align 8
  store %struct.A* %this, %struct.A** %this.addr, align 8
  %this1 = load %struct.A*, %struct.A** %this.addr, align 8
  call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @"??_C@_0N@HMNCGOCN@?5in?5A?5dtor?5?6?$AA@", i64 0, i64 0))
  ret void
}

; Function Attrs: noinline norecurse optnone
define dso_local i32 @main() #3 personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
entry:
  %retval = alloca i32, align 4
  %i = alloca i32, align 4
  %__exception_code = alloca i32, align 4
  store i32 0, i32* %retval, align 4
  store i32 0, i32* %i, align 4
  br label %for.cond

for.cond:                                         ; preds = %for.inc, %entry
  %0 = load i32, i32* %i, align 4
  %cmp = icmp slt i32 %0, 3
  br i1 %cmp, label %for.body, label %for.end

for.body:                                         ; preds = %for.cond
  invoke void @llvm.seh.try.begin()
          to label %invoke.cont unwind label %catch.dispatch

invoke.cont:                                      ; preds = %for.body
  %1 = load volatile i32, i32* %i, align 4
  invoke void @"?crash@@YAXH@Z"(i32 %1) #7
          to label %invoke.cont1 unwind label %catch.dispatch

invoke.cont1:                                     ; preds = %invoke.cont
  invoke void @llvm.seh.try.end()
          to label %invoke.cont2 unwind label %catch.dispatch

catch.dispatch:                                   ; preds = %invoke.cont1, %invoke.cont, %for.body
  %2 = catchswitch within none [label %__except] unwind to caller

__except:                                         ; preds = %catch.dispatch
  %3 = catchpad within %2 [i8* null]
  catchret from %3 to label %__except3

__except3:                                        ; preds = %__except
  %4 = call i32 @llvm.eh.exceptioncode(token %3)
  store i32 %4, i32* %__exception_code, align 4
  %5 = load i32, i32* %i, align 4
  call void (...) @"?printf@@YAXZZ"(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @"??_C@_0CM@KAOHJHDK@?5Test?5CPP?5unwind?3?5in?5catch?5handl@", i64 0, i64 0), i32 %5)
  br label %__try.cont

__try.cont:                                       ; preds = %__except3, %invoke.cont2
  br label %for.inc

for.inc:                                          ; preds = %__try.cont
  %6 = load i32, i32* %i, align 4
  %inc = add nsw i32 %6, 1
  store i32 %inc, i32* %i, align 4
  br label %for.cond

invoke.cont2:                                     ; preds = %invoke.cont1
  br label %__try.cont

for.end:                                          ; preds = %for.cond
  ret i32 0
}

; Function Attrs: nounwind willreturn
declare dso_local void @llvm.seh.try.begin() #4

declare dso_local i32 @__C_specific_handler(...)

; Function Attrs: nounwind willreturn
declare dso_local void @llvm.seh.try.end() #4

; Function Attrs: nounwind readnone
declare i32 @llvm.eh.exceptioncode(token) #1

declare dso_local void @"?printf@@YAXZZ"(...) #5

attributes #0 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone }
attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { noinline norecurse optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #4 = { nounwind willreturn }
attributes #5 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #6 = { nounwind }
attributes #7 = { noinline }

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

!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{i32 2, !"eh-asynch", i32 1}