File: llvm-string_11-e6c763f.stdout

package info (click to toggle)
lfortran 0.58.0-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 54,508 kB
  • sloc: cpp: 162,179; f90: 68,251; python: 17,476; ansic: 6,278; yacc: 2,334; sh: 1,317; fortran: 892; makefile: 34; javascript: 15
file content (427 lines) | stat: -rw-r--r-- 18,563 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
; ModuleID = 'LFortran'
source_filename = "LFortran"

%string_descriptor = type <{ i8*, i64 }>

@string_const_data = private constant [14 x i8] c"This is a test"
@string_const = private global %string_descriptor <{ i8* getelementptr inbounds ([14 x i8], [14 x i8]* @string_const_data, i32 0, i32 0), i64 14 }>
@string_const_data.1 = private constant [4 x i8] c"test"
@string_const.2 = private global %string_descriptor <{ i8* getelementptr inbounds ([4 x i8], [4 x i8]* @string_const_data.1, i32 0, i32 0), i64 4 }>
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@string_const_data.3 = private constant [17 x i8] c"test is not found"
@string_const.4 = private global %string_descriptor <{ i8* getelementptr inbounds ([17 x i8], [17 x i8]* @string_const_data.3, i32 0, i32 0), i64 17 }>
@1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [13 x i8] c"S-DESC-24,I4\00", align 1
@string_const_data.5 = private constant [24 x i8] c"test is found at index: "
@string_const.6 = private global %string_descriptor <{ i8* getelementptr inbounds ([24 x i8], [24 x i8]* @string_const_data.5, i32 0, i32 0), i64 24 }>
@3 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1

define i32 @_lcompilers_index_str(%string_descriptor* %str, %string_descriptor* %substr, i1* %back, i32* %kind) {
.entry:
  %_lcompilers_index_str = alloca i32, align 4
  %found = alloca i1, align 1
  %i = alloca i32, align 4
  %j = alloca i32, align 4
  %k = alloca i32, align 4
  %pos = alloca i32, align 4
  store i32 0, i32* %_lcompilers_index_str, align 4
  store i32 1, i32* %i, align 4
  store i1 true, i1* %found, align 1
  %0 = getelementptr %string_descriptor, %string_descriptor* %str, i32 0, i32 1
  %1 = load i64, i64* %0, align 4
  %2 = trunc i64 %1 to i32
  %3 = getelementptr %string_descriptor, %string_descriptor* %substr, i32 0, i32 1
  %4 = load i64, i64* %3, align 4
  %5 = trunc i64 %4 to i32
  %6 = icmp slt i32 %2, %5
  br i1 %6, label %then, label %else

then:                                             ; preds = %.entry
  store i1 false, i1* %found, align 1
  br label %ifcont

else:                                             ; preds = %.entry
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  br label %loop.head

loop.head:                                        ; preds = %ifcont10, %ifcont
  %7 = load i32, i32* %i, align 4
  %8 = getelementptr %string_descriptor, %string_descriptor* %str, i32 0, i32 1
  %9 = load i64, i64* %8, align 4
  %10 = trunc i64 %9 to i32
  %11 = add i32 %10, 1
  %12 = icmp slt i32 %7, %11
  %13 = load i1, i1* %found, align 1
  %14 = zext i1 %13 to i32
  %15 = icmp eq i32 %14, 1
  %16 = icmp eq i1 %12, false
  %17 = select i1 %16, i1 %12, i1 %15
  br i1 %17, label %loop.body, label %loop.end11

loop.body:                                        ; preds = %loop.head
  store i32 0, i32* %k, align 4
  store i32 1, i32* %j, align 4
  br label %loop.head1

loop.head1:                                       ; preds = %ifcont7, %loop.body
  %18 = load i32, i32* %j, align 4
  %19 = getelementptr %string_descriptor, %string_descriptor* %substr, i32 0, i32 1
  %20 = load i64, i64* %19, align 4
  %21 = trunc i64 %20 to i32
  %22 = icmp sle i32 %18, %21
  %23 = load i1, i1* %found, align 1
  %24 = zext i1 %23 to i32
  %25 = icmp eq i32 %24, 1
  %26 = icmp eq i1 %22, false
  %27 = select i1 %26, i1 %22, i1 %25
  br i1 %27, label %loop.body2, label %loop.end

loop.body2:                                       ; preds = %loop.head1
  %28 = load i32, i32* %i, align 4
  %29 = load i32, i32* %k, align 4
  %30 = add i32 %28, %29
  store i32 %30, i32* %pos, align 4
  %31 = load i32, i32* %pos, align 4
  %32 = load i32, i32* %pos, align 4
  %33 = sext i32 %31 to i64
  %34 = sext i32 %32 to i64
  %35 = sub i64 %34, %33
  %36 = add i64 %35, 1
  %37 = getelementptr %string_descriptor, %string_descriptor* %str, i32 0, i32 0
  %38 = load i8*, i8** %37, align 8
  %39 = sext i32 %31 to i64
  %40 = sub i64 %39, 1
  %StrSliceGEP = getelementptr i8, i8* %38, i64 %40
  %StrSlice_StrView = alloca %string_descriptor, align 8
  %41 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 0
  store i8* %StrSliceGEP, i8** %41, align 8
  %42 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 1
  store i64 %36, i64* %42, align 4
  %43 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 0
  %44 = load i8*, i8** %43, align 8
  %45 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 1
  %46 = load i64, i64* %45, align 4
  %47 = load i32, i32* %j, align 4
  %48 = load i32, i32* %j, align 4
  %49 = sext i32 %47 to i64
  %50 = sext i32 %48 to i64
  %51 = sub i64 %50, %49
  %52 = add i64 %51, 1
  %53 = getelementptr %string_descriptor, %string_descriptor* %substr, i32 0, i32 0
  %54 = load i8*, i8** %53, align 8
  %55 = sext i32 %47 to i64
  %56 = sub i64 %55, 1
  %StrSliceGEP3 = getelementptr i8, i8* %54, i64 %56
  %StrSlice_StrView4 = alloca %string_descriptor, align 8
  %57 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 0
  store i8* %StrSliceGEP3, i8** %57, align 8
  %58 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 1
  store i64 %52, i64* %58, align 4
  %59 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 0
  %60 = load i8*, i8** %59, align 8
  %61 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 1
  %62 = load i64, i64* %61, align 4
  %63 = call i32 @str_compare(i8* %44, i64 %46, i8* %60, i64 %62)
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %then5, label %else6

then5:                                            ; preds = %loop.body2
  store i1 false, i1* %found, align 1
  br label %ifcont7

else6:                                            ; preds = %loop.body2
  br label %ifcont7

ifcont7:                                          ; preds = %else6, %then5
  %65 = load i32, i32* %j, align 4
  %66 = add i32 %65, 1
  store i32 %66, i32* %j, align 4
  %67 = load i32, i32* %k, align 4
  %68 = add i32 %67, 1
  store i32 %68, i32* %k, align 4
  br label %loop.head1

loop.end:                                         ; preds = %loop.head1
  %69 = load i1, i1* %found, align 1
  %70 = zext i1 %69 to i32
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %then8, label %else9

then8:                                            ; preds = %loop.end
  %72 = load i32, i32* %i, align 4
  store i32 %72, i32* %_lcompilers_index_str, align 4
  %73 = load i1, i1* %back, align 1
  store i1 %73, i1* %found, align 1
  br label %ifcont10

else9:                                            ; preds = %loop.end
  store i1 true, i1* %found, align 1
  br label %ifcont10

ifcont10:                                         ; preds = %else9, %then8
  %74 = load i32, i32* %i, align 4
  %75 = add i32 %74, 1
  store i32 %75, i32* %i, align 4
  br label %loop.head

loop.end11:                                       ; preds = %loop.head
  br label %return

return:                                           ; preds = %loop.end11
  %76 = load i32, i32* %_lcompilers_index_str, align 4
  ret i32 %76
}

define i32 @_lcompilers_index_str1(%string_descriptor* %str, %string_descriptor* %substr, i1* %back, i32* %kind) {
.entry:
  %_lcompilers_index_str1 = alloca i32, align 4
  %found = alloca i1, align 1
  %i = alloca i32, align 4
  %j = alloca i32, align 4
  %k = alloca i32, align 4
  %pos = alloca i32, align 4
  store i32 0, i32* %_lcompilers_index_str1, align 4
  store i32 1, i32* %i, align 4
  store i1 true, i1* %found, align 1
  %0 = getelementptr %string_descriptor, %string_descriptor* %str, i32 0, i32 1
  %1 = load i64, i64* %0, align 4
  %2 = trunc i64 %1 to i32
  %3 = getelementptr %string_descriptor, %string_descriptor* %substr, i32 0, i32 1
  %4 = load i64, i64* %3, align 4
  %5 = trunc i64 %4 to i32
  %6 = icmp slt i32 %2, %5
  br i1 %6, label %then, label %else

then:                                             ; preds = %.entry
  store i1 false, i1* %found, align 1
  br label %ifcont

else:                                             ; preds = %.entry
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  br label %loop.head

loop.head:                                        ; preds = %ifcont10, %ifcont
  %7 = load i32, i32* %i, align 4
  %8 = getelementptr %string_descriptor, %string_descriptor* %str, i32 0, i32 1
  %9 = load i64, i64* %8, align 4
  %10 = trunc i64 %9 to i32
  %11 = add i32 %10, 1
  %12 = icmp slt i32 %7, %11
  %13 = load i1, i1* %found, align 1
  %14 = zext i1 %13 to i32
  %15 = icmp eq i32 %14, 1
  %16 = icmp eq i1 %12, false
  %17 = select i1 %16, i1 %12, i1 %15
  br i1 %17, label %loop.body, label %loop.end11

loop.body:                                        ; preds = %loop.head
  store i32 0, i32* %k, align 4
  store i32 1, i32* %j, align 4
  br label %loop.head1

loop.head1:                                       ; preds = %ifcont7, %loop.body
  %18 = load i32, i32* %j, align 4
  %19 = getelementptr %string_descriptor, %string_descriptor* %substr, i32 0, i32 1
  %20 = load i64, i64* %19, align 4
  %21 = trunc i64 %20 to i32
  %22 = icmp sle i32 %18, %21
  %23 = load i1, i1* %found, align 1
  %24 = zext i1 %23 to i32
  %25 = icmp eq i32 %24, 1
  %26 = icmp eq i1 %22, false
  %27 = select i1 %26, i1 %22, i1 %25
  br i1 %27, label %loop.body2, label %loop.end

loop.body2:                                       ; preds = %loop.head1
  %28 = load i32, i32* %i, align 4
  %29 = load i32, i32* %k, align 4
  %30 = add i32 %28, %29
  store i32 %30, i32* %pos, align 4
  %31 = load i32, i32* %pos, align 4
  %32 = load i32, i32* %pos, align 4
  %33 = sext i32 %31 to i64
  %34 = sext i32 %32 to i64
  %35 = sub i64 %34, %33
  %36 = add i64 %35, 1
  %37 = getelementptr %string_descriptor, %string_descriptor* %str, i32 0, i32 0
  %38 = load i8*, i8** %37, align 8
  %39 = sext i32 %31 to i64
  %40 = sub i64 %39, 1
  %StrSliceGEP = getelementptr i8, i8* %38, i64 %40
  %StrSlice_StrView = alloca %string_descriptor, align 8
  %41 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 0
  store i8* %StrSliceGEP, i8** %41, align 8
  %42 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 1
  store i64 %36, i64* %42, align 4
  %43 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 0
  %44 = load i8*, i8** %43, align 8
  %45 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView, i32 0, i32 1
  %46 = load i64, i64* %45, align 4
  %47 = load i32, i32* %j, align 4
  %48 = load i32, i32* %j, align 4
  %49 = sext i32 %47 to i64
  %50 = sext i32 %48 to i64
  %51 = sub i64 %50, %49
  %52 = add i64 %51, 1
  %53 = getelementptr %string_descriptor, %string_descriptor* %substr, i32 0, i32 0
  %54 = load i8*, i8** %53, align 8
  %55 = sext i32 %47 to i64
  %56 = sub i64 %55, 1
  %StrSliceGEP3 = getelementptr i8, i8* %54, i64 %56
  %StrSlice_StrView4 = alloca %string_descriptor, align 8
  %57 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 0
  store i8* %StrSliceGEP3, i8** %57, align 8
  %58 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 1
  store i64 %52, i64* %58, align 4
  %59 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 0
  %60 = load i8*, i8** %59, align 8
  %61 = getelementptr %string_descriptor, %string_descriptor* %StrSlice_StrView4, i32 0, i32 1
  %62 = load i64, i64* %61, align 4
  %63 = call i32 @str_compare(i8* %44, i64 %46, i8* %60, i64 %62)
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %then5, label %else6

then5:                                            ; preds = %loop.body2
  store i1 false, i1* %found, align 1
  br label %ifcont7

else6:                                            ; preds = %loop.body2
  br label %ifcont7

ifcont7:                                          ; preds = %else6, %then5
  %65 = load i32, i32* %j, align 4
  %66 = add i32 %65, 1
  store i32 %66, i32* %j, align 4
  %67 = load i32, i32* %k, align 4
  %68 = add i32 %67, 1
  store i32 %68, i32* %k, align 4
  br label %loop.head1

loop.end:                                         ; preds = %loop.head1
  %69 = load i1, i1* %found, align 1
  %70 = zext i1 %69 to i32
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %then8, label %else9

then8:                                            ; preds = %loop.end
  %72 = load i32, i32* %i, align 4
  store i32 %72, i32* %_lcompilers_index_str1, align 4
  %73 = load i1, i1* %back, align 1
  store i1 %73, i1* %found, align 1
  br label %ifcont10

else9:                                            ; preds = %loop.end
  store i1 true, i1* %found, align 1
  br label %ifcont10

ifcont10:                                         ; preds = %else9, %then8
  %74 = load i32, i32* %i, align 4
  %75 = add i32 %74, 1
  store i32 %75, i32* %i, align 4
  br label %loop.head

loop.end11:                                       ; preds = %loop.head
  br label %return

return:                                           ; preds = %loop.end11
  %76 = load i32, i32* %_lcompilers_index_str1, align 4
  ret i32 %76
}

declare i32 @str_compare(i8*, i64, i8*, i64)

define i32 @main(i32 %0, i8** %1) {
.entry:
  %call_arg_value3 = alloca i32, align 4
  %call_arg_value2 = alloca i1, align 1
  %call_arg_value1 = alloca i32, align 4
  %call_arg_value = alloca i1, align 1
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %mystring = alloca %string_descriptor, align 8
  store %string_descriptor zeroinitializer, %string_descriptor* %mystring, align 1
  %2 = getelementptr %string_descriptor, %string_descriptor* %mystring, i32 0, i32 1
  store i64 30, i64* %2, align 4
  %3 = getelementptr %string_descriptor, %string_descriptor* %mystring, i32 0, i32 0
  %4 = call i8* @_lfortran_malloc(i64 30)
  store i8* %4, i8** %3, align 8
  %teststring = alloca %string_descriptor, align 8
  store %string_descriptor zeroinitializer, %string_descriptor* %teststring, align 1
  %5 = getelementptr %string_descriptor, %string_descriptor* %teststring, i32 0, i32 1
  store i64 10, i64* %5, align 4
  %6 = getelementptr %string_descriptor, %string_descriptor* %teststring, i32 0, i32 0
  %7 = call i8* @_lfortran_malloc(i64 10)
  store i8* %7, i8** %6, align 8
  %8 = getelementptr %string_descriptor, %string_descriptor* %mystring, i32 0, i32 0
  %9 = getelementptr %string_descriptor, %string_descriptor* %mystring, i32 0, i32 1
  %10 = load i8*, i8** getelementptr inbounds (%string_descriptor, %string_descriptor* @string_const, i32 0, i32 0), align 8
  call void @_lfortran_strcpy(i8** %8, i64* %9, i8 0, i8 0, i8* %10, i64 14)
  %11 = getelementptr %string_descriptor, %string_descriptor* %teststring, i32 0, i32 0
  %12 = getelementptr %string_descriptor, %string_descriptor* %teststring, i32 0, i32 1
  %13 = load i8*, i8** getelementptr inbounds (%string_descriptor, %string_descriptor* @string_const.2, i32 0, i32 0), align 8
  call void @_lfortran_strcpy(i8** %11, i64* %12, i8 0, i8 0, i8* %13, i64 4)
  store i1 false, i1* %call_arg_value, align 1
  store i32 4, i32* %call_arg_value1, align 4
  %14 = call i32 @_lcompilers_index_str(%string_descriptor* %mystring, %string_descriptor* %teststring, i1* %call_arg_value, i32* %call_arg_value1)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %then, label %else

then:                                             ; preds = %.entry
  %16 = load i8*, i8** getelementptr inbounds (%string_descriptor, %string_descriptor* @string_const.4, i32 0, i32 0), align 8
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %16, i32 17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i32 1)
  br label %ifcont

else:                                             ; preds = %.entry
  %17 = alloca i64, align 8
  store i1 false, i1* %call_arg_value2, align 1
  store i32 4, i32* %call_arg_value3, align 4
  %18 = call i32 @_lcompilers_index_str1(%string_descriptor* %mystring, %string_descriptor* %teststring, i1* %call_arg_value2, i32* %call_arg_value3)
  %19 = alloca i32, align 4
  store i32 %18, i32* %19, align 4
  %20 = call i8* (i8*, i64, i8*, i64*, i32, i32, ...) @_lcompilers_string_format_fortran(i8* null, i64 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @serialization_info, i32 0, i32 0), i64* %17, i32 0, i32 0, %string_descriptor* @string_const.6, i32* %19)
  %21 = load i64, i64* %17, align 4
  %stringFormat_desc = alloca %string_descriptor, align 8
  %22 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %20, i8** %22, align 8
  %23 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %21, i64* %23, align 4
  %24 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %25 = load i8*, i8** %24, align 8
  %26 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %27 = load i64, i64* %26, align 4
  %28 = trunc i64 %27 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %25, i32 %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0), i32 1)
  call void @_lfortran_free(i8* %20)
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %ifcont
  %29 = getelementptr %string_descriptor, %string_descriptor* %mystring, i32 0, i32 0
  %30 = load i8*, i8** %29, align 8
  call void @_lfortran_free(i8* %30)
  %31 = getelementptr %string_descriptor, %string_descriptor* %teststring, i32 0, i32 0
  %32 = load i8*, i8** %31, align 8
  call void @_lfortran_free(i8* %32)
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

declare i8* @_lfortran_malloc(i64)

declare void @_lfortran_strcpy(i8**, i64*, i8, i8, i8*, i64)

declare void @_lfortran_printf(i8*, i8*, i32, i8*, i32)

declare i8* @_lcompilers_string_format_fortran(i8*, i64, i8*, i64*, i32, i32, ...)

declare void @_lfortran_free(i8*)

declare void @_lpython_free_argv()