-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtls-c.ll
64 lines (54 loc) · 3.41 KB
/
tls-c.ll
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
; ModuleID = 'tls.c'
source_filename = "tls.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%union.pthread_attr_t = type { i64, [48 x i8] }
@threadLocalVar = private thread_local(initialexec) global i32 0, align 4
@.str = private unnamed_addr constant [32 x i8] c"Thread %d: threadLocalVar = %d\0A\00", align 1
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i8* @threadFunction(i8* %0) #0 {
%2 = alloca i8*, align 8
store i8* %0, i8** %2, align 8
%3 = load i8*, i8** %2, align 8
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4, align 4
store i32 %5, i32* @threadLocalVar, align 4
%6 = load i8*, i8** %2, align 8
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7, align 4
%9 = load i32, i32* @threadLocalVar, align 4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i8* null
}
declare dso_local i32 @printf(i8*, ...) #1
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @main() #0 {
%1 = alloca i32, align 4
%2 = alloca i64, align 8
%3 = alloca i64, align 8
%4 = alloca i32, align 4
%5 = alloca i32, align 4
store i32 0, i32* %1, align 4
store i32 1, i32* %4, align 4
store i32 2, i32* %5, align 4
%6 = bitcast i32* %4 to i8*
%7 = call i32 @pthread_create(i64* %2, %union.pthread_attr_t* null, i8* (i8*)* @threadFunction, i8* %6) #3
%8 = bitcast i32* %5 to i8*
%9 = call i32 @pthread_create(i64* %3, %union.pthread_attr_t* null, i8* (i8*)* @threadFunction, i8* %8) #3
%10 = load i64, i64* %2, align 8
%11 = call i32 @pthread_join(i64 %10, i8** null)
%12 = load i64, i64* %3, align 8
%13 = call i32 @pthread_join(i64 %12, i8** null)
ret i32 0
}
; Function Attrs: nounwind
declare dso_local i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*) #2
declare dso_local i32 @pthread_join(i64, i8**) #1
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "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"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"Ubuntu clang version 11.1.0-6"}