Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ModuleID = 'example.c'
- target datalayout = "e-m:e-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] }
- @x = global i32 0, align 4
- @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
- ; Function Attrs: nounwind uwtable
- define i8* @increment(i8* %threadid) #0 !dbg !11 {
- %1 = alloca i8*, align 8
- %i = alloca i32, align 4
- store i8* %threadid, i8** %1, align 8
- call void @llvm.dbg.declare(metadata i8** %1, metadata !25, metadata !26), !dbg !27
- call void @llvm.dbg.declare(metadata i32* %i, metadata !28, metadata !26), !dbg !30
- store i32 0, i32* %i, align 4, !dbg !30
- br label %2, !dbg !31
- ; <label>:2 ; preds = %8, %0
- %3 = load i32, i32* %i, align 4, !dbg !32
- %4 = icmp slt i32 %3, 100000000, !dbg !35
- br i1 %4, label %5, label %11, !dbg !36
- ; <label>:5 ; preds = %2
- %6 = load i32, i32* @x, align 4, !dbg !37
- %7 = add nsw i32 %6, 1, !dbg !37
- store i32 %7, i32* @x, align 4, !dbg !37
- br label %8, !dbg !39
- ; <label>:8 ; preds = %5
- %9 = load i32, i32* %i, align 4, !dbg !40
- %10 = add nsw i32 %9, 1, !dbg !40
- store i32 %10, i32* %i, align 4, !dbg !40
- br label %2, !dbg !42
- ; <label>:11 ; preds = %2
- ret i8* null, !dbg !43
- }
- ; Function Attrs: nounwind readnone
- declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
- ; Function Attrs: nounwind uwtable
- define i8* @decrement(i8* %threadid) #0 !dbg !15 {
- %1 = alloca i8*, align 8
- %i = alloca i32, align 4
- store i8* %threadid, i8** %1, align 8
- call void @llvm.dbg.declare(metadata i8** %1, metadata !44, metadata !26), !dbg !45
- call void @llvm.dbg.declare(metadata i32* %i, metadata !46, metadata !26), !dbg !48
- store i32 0, i32* %i, align 4, !dbg !48
- br label %2, !dbg !49
- ; <label>:2 ; preds = %8, %0
- %3 = load i32, i32* %i, align 4, !dbg !50
- %4 = icmp slt i32 %3, 100000000, !dbg !53
- br i1 %4, label %5, label %11, !dbg !54
- ; <label>:5 ; preds = %2
- %6 = load i32, i32* @x, align 4, !dbg !55
- %7 = add nsw i32 %6, -1, !dbg !55
- store i32 %7, i32* @x, align 4, !dbg !55
- br label %8, !dbg !57
- ; <label>:8 ; preds = %5
- %9 = load i32, i32* %i, align 4, !dbg !58
- %10 = add nsw i32 %9, 1, !dbg !58
- store i32 %10, i32* %i, align 4, !dbg !58
- br label %2, !dbg !60
- ; <label>:11 ; preds = %2
- ret i8* null, !dbg !61
- }
- ; Function Attrs: nounwind uwtable
- define i32 @main() #0 !dbg !16 {
- %1 = alloca i32, align 4
- %threads = alloca [2 x i64], align 16
- %attr = alloca %union.pthread_attr_t, align 8
- %status = alloca i8*, align 8
- store i32 0, i32* %1, align 4
- call void @llvm.dbg.declare(metadata [2 x i64]* %threads, metadata !62, metadata !26), !dbg !69
- call void @llvm.dbg.declare(metadata %union.pthread_attr_t* %attr, metadata !70, metadata !26), !dbg !81
- call void @llvm.dbg.declare(metadata i8** %status, metadata !82, metadata !26), !dbg !83
- %2 = call i32 @pthread_attr_init(%union.pthread_attr_t* %attr) #4, !dbg !84
- %3 = call i32 @pthread_attr_setdetachstate(%union.pthread_attr_t* %attr, i32 0) #4, !dbg !85
- %4 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 0, !dbg !86
- %5 = call i32 @pthread_create(i64* %4, %union.pthread_attr_t* null, i8* (i8*)* @increment, i8* inttoptr (i64 1 to i8*)) #4, !dbg !87
- %6 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 1, !dbg !88
- %7 = call i32 @pthread_create(i64* %6, %union.pthread_attr_t* null, i8* (i8*)* @decrement, i8* inttoptr (i64 2 to i8*)) #4, !dbg !89
- %8 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 0, !dbg !90
- %9 = load i64, i64* %8, align 16, !dbg !90
- %10 = call i32 @pthread_join(i64 %9, i8** %status), !dbg !91
- %11 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 1, !dbg !92
- %12 = load i64, i64* %11, align 8, !dbg !92
- %13 = call i32 @pthread_join(i64 %12, i8** %status), !dbg !93
- %14 = load i32, i32* @x, align 4, !dbg !94
- %15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %14), !dbg !95
- ret i32 0, !dbg !96
- }
- ; Function Attrs: nounwind
- declare i32 @pthread_attr_init(%union.pthread_attr_t*) #2
- ; Function Attrs: nounwind
- declare i32 @pthread_attr_setdetachstate(%union.pthread_attr_t*, i32) #2
- ; Function Attrs: nounwind
- declare i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*) #2
- declare i32 @pthread_join(i64, i8**) #3
- declare i32 @printf(i8*, ...) #3
- attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
- attributes #1 = { nounwind readnone }
- attributes #2 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
- attributes #3 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
- attributes #4 = { nounwind }
- !llvm.dbg.cu = !{!0}
- !llvm.module.flags = !{!22, !23}
- !llvm.ident = !{!24}
- !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !8, subprograms: !10, globals: !20)
- !1 = !DIFile(filename: "example.c", directory: "/home/michael")
- !2 = !{!3}
- !3 = !DICompositeType(tag: DW_TAG_enumeration_type, file: !4, line: 32, size: 32, align: 32, elements: !5)
- !4 = !DIFile(filename: "/usr/include/pthread.h", directory: "/home/michael")
- !5 = !{!6, !7}
- !6 = !DIEnumerator(name: "PTHREAD_CREATE_JOINABLE", value: 0)
- !7 = !DIEnumerator(name: "PTHREAD_CREATE_DETACHED", value: 1)
- !8 = !{!9}
- !9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64, align: 64)
- !10 = !{!11, !15, !16}
- !11 = distinct !DISubprogram(name: "increment", scope: !1, file: !1, line: 9, type: !12, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, variables: !14)
- !12 = !DISubroutineType(types: !13)
- !13 = !{!9, !9}
- !14 = !{}
- !15 = distinct !DISubprogram(name: "decrement", scope: !1, file: !1, line: 16, type: !12, isLocal: false, isDefinition: true, scopeLine: 16, flags: DIFlagPrototyped, isOptimized: false, variables: !14)
- !16 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 23, type: !17, isLocal: false, isDefinition: true, scopeLine: 23, isOptimized: false, variables: !14)
- !17 = !DISubroutineType(types: !18)
- !18 = !{!19}
- !19 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
- !20 = !{!21}
- !21 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 7, type: !19, isLocal: false, isDefinition: true, variable: i32* @x)
- !22 = !{i32 2, !"Dwarf Version", i32 4}
- !23 = !{i32 2, !"Debug Info Version", i32 3}
- !24 = !{!"clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)"}
- !25 = !DILocalVariable(name: "threadid", arg: 1, scope: !11, file: !1, line: 9, type: !9)
- !26 = !DIExpression()
- !27 = !DILocation(line: 9, column: 23, scope: !11)
- !28 = !DILocalVariable(name: "i", scope: !29, file: !1, line: 10, type: !19)
- !29 = distinct !DILexicalBlock(scope: !11, file: !1, line: 10, column: 4)
- !30 = !DILocation(line: 10, column: 13, scope: !29)
- !31 = !DILocation(line: 10, column: 9, scope: !29)
- !32 = !DILocation(line: 10, column: 20, scope: !33)
- !33 = !DILexicalBlockFile(scope: !34, file: !1, discriminator: 1)
- !34 = distinct !DILexicalBlock(scope: !29, file: !1, line: 10, column: 4)
- !35 = !DILocation(line: 10, column: 22, scope: !33)
- !36 = !DILocation(line: 10, column: 4, scope: !33)
- !37 = !DILocation(line: 11, column: 7, scope: !38)
- !38 = distinct !DILexicalBlock(scope: !34, file: !1, line: 10, column: 39)
- !39 = !DILocation(line: 12, column: 5, scope: !38)
- !40 = !DILocation(line: 10, column: 36, scope: !41)
- !41 = !DILexicalBlockFile(scope: !34, file: !1, discriminator: 2)
- !42 = !DILocation(line: 10, column: 4, scope: !41)
- !43 = !DILocation(line: 13, column: 7, scope: !11)
- !44 = !DILocalVariable(name: "threadid", arg: 1, scope: !15, file: !1, line: 16, type: !9)
- !45 = !DILocation(line: 16, column: 23, scope: !15)
- !46 = !DILocalVariable(name: "i", scope: !47, file: !1, line: 17, type: !19)
- !47 = distinct !DILexicalBlock(scope: !15, file: !1, line: 17, column: 4)
- !48 = !DILocation(line: 17, column: 13, scope: !47)
- !49 = !DILocation(line: 17, column: 9, scope: !47)
- !50 = !DILocation(line: 17, column: 20, scope: !51)
- !51 = !DILexicalBlockFile(scope: !52, file: !1, discriminator: 1)
- !52 = distinct !DILexicalBlock(scope: !47, file: !1, line: 17, column: 4)
- !53 = !DILocation(line: 17, column: 22, scope: !51)
- !54 = !DILocation(line: 17, column: 4, scope: !51)
- !55 = !DILocation(line: 18, column: 8, scope: !56)
- !56 = distinct !DILexicalBlock(scope: !52, file: !1, line: 17, column: 39)
- !57 = !DILocation(line: 19, column: 5, scope: !56)
- !58 = !DILocation(line: 17, column: 36, scope: !59)
- !59 = !DILexicalBlockFile(scope: !52, file: !1, discriminator: 2)
- !60 = !DILocation(line: 17, column: 4, scope: !59)
- !61 = !DILocation(line: 20, column: 7, scope: !15)
- !62 = !DILocalVariable(name: "threads", scope: !16, file: !1, line: 24, type: !63)
- !63 = !DICompositeType(tag: DW_TAG_array_type, baseType: !64, size: 128, align: 64, elements: !67)
- !64 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_t", file: !65, line: 60, baseType: !66)
- !65 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h", directory: "/home/michael")
- !66 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
- !67 = !{!68}
- !68 = !DISubrange(count: 2)
- !69 = !DILocation(line: 24, column: 14, scope: !16)
- !70 = !DILocalVariable(name: "attr", scope: !16, file: !1, line: 25, type: !71)
- !71 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_attr_t", file: !65, line: 69, baseType: !72)
- !72 = !DICompositeType(tag: DW_TAG_union_type, name: "pthread_attr_t", file: !65, line: 63, size: 448, align: 64, elements: !73)
- !73 = !{!74, !79}
- !74 = !DIDerivedType(tag: DW_TAG_member, name: "__size", scope: !72, file: !65, line: 65, baseType: !75, size: 448, align: 8)
- !75 = !DICompositeType(tag: DW_TAG_array_type, baseType: !76, size: 448, align: 8, elements: !77)
- !76 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
- !77 = !{!78}
- !78 = !DISubrange(count: 56)
- !79 = !DIDerivedType(tag: DW_TAG_member, name: "__align", scope: !72, file: !65, line: 66, baseType: !80, size: 64, align: 64)
- !80 = !DIBasicType(name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
- !81 = !DILocation(line: 25, column: 19, scope: !16)
- !82 = !DILocalVariable(name: "status", scope: !16, file: !1, line: 26, type: !9)
- !83 = !DILocation(line: 26, column: 10, scope: !16)
- !84 = !DILocation(line: 29, column: 4, scope: !16)
- !85 = !DILocation(line: 30, column: 4, scope: !16)
- !86 = !DILocation(line: 32, column: 20, scope: !16)
- !87 = !DILocation(line: 32, column: 4, scope: !16)
- !88 = !DILocation(line: 33, column: 20, scope: !16)
- !89 = !DILocation(line: 33, column: 4, scope: !16)
- !90 = !DILocation(line: 34, column: 17, scope: !16)
- !91 = !DILocation(line: 34, column: 4, scope: !16)
- !92 = !DILocation(line: 35, column: 17, scope: !16)
- !93 = !DILocation(line: 35, column: 4, scope: !16)
- !94 = !DILocation(line: 36, column: 19, scope: !16)
- !95 = !DILocation(line: 36, column: 4, scope: !16)
- !96 = !DILocation(line: 38, column: 4, scope: !16)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement