Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.19 KB | None | 0 0
  1. ; ModuleID = 'example.c'
  2. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  3. target triple = "x86_64-pc-linux-gnu"
  4.  
  5. %union.pthread_attr_t = type { i64, [48 x i8] }
  6.  
  7. @x = global i32 0, align 4
  8. @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
  9.  
  10. ; Function Attrs: nounwind uwtable
  11. define i8* @increment(i8* %threadid) #0 !dbg !11 {
  12. %1 = alloca i8*, align 8
  13. %i = alloca i32, align 4
  14. store i8* %threadid, i8** %1, align 8
  15. call void @llvm.dbg.declare(metadata i8** %1, metadata !25, metadata !26), !dbg !27
  16. call void @llvm.dbg.declare(metadata i32* %i, metadata !28, metadata !26), !dbg !30
  17. store i32 0, i32* %i, align 4, !dbg !30
  18. br label %2, !dbg !31
  19.  
  20. ; <label>:2 ; preds = %8, %0
  21. %3 = load i32, i32* %i, align 4, !dbg !32
  22. %4 = icmp slt i32 %3, 100000000, !dbg !35
  23. br i1 %4, label %5, label %11, !dbg !36
  24.  
  25. ; <label>:5 ; preds = %2
  26. %6 = load i32, i32* @x, align 4, !dbg !37
  27. %7 = add nsw i32 %6, 1, !dbg !37
  28. store i32 %7, i32* @x, align 4, !dbg !37
  29. br label %8, !dbg !39
  30.  
  31. ; <label>:8 ; preds = %5
  32. %9 = load i32, i32* %i, align 4, !dbg !40
  33. %10 = add nsw i32 %9, 1, !dbg !40
  34. store i32 %10, i32* %i, align 4, !dbg !40
  35. br label %2, !dbg !42
  36.  
  37. ; <label>:11 ; preds = %2
  38. ret i8* null, !dbg !43
  39. }
  40.  
  41. ; Function Attrs: nounwind readnone
  42. declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
  43.  
  44. ; Function Attrs: nounwind uwtable
  45. define i8* @decrement(i8* %threadid) #0 !dbg !15 {
  46. %1 = alloca i8*, align 8
  47. %i = alloca i32, align 4
  48. store i8* %threadid, i8** %1, align 8
  49. call void @llvm.dbg.declare(metadata i8** %1, metadata !44, metadata !26), !dbg !45
  50. call void @llvm.dbg.declare(metadata i32* %i, metadata !46, metadata !26), !dbg !48
  51. store i32 0, i32* %i, align 4, !dbg !48
  52. br label %2, !dbg !49
  53.  
  54. ; <label>:2 ; preds = %8, %0
  55. %3 = load i32, i32* %i, align 4, !dbg !50
  56. %4 = icmp slt i32 %3, 100000000, !dbg !53
  57. br i1 %4, label %5, label %11, !dbg !54
  58.  
  59. ; <label>:5 ; preds = %2
  60. %6 = load i32, i32* @x, align 4, !dbg !55
  61. %7 = add nsw i32 %6, -1, !dbg !55
  62. store i32 %7, i32* @x, align 4, !dbg !55
  63. br label %8, !dbg !57
  64.  
  65. ; <label>:8 ; preds = %5
  66. %9 = load i32, i32* %i, align 4, !dbg !58
  67. %10 = add nsw i32 %9, 1, !dbg !58
  68. store i32 %10, i32* %i, align 4, !dbg !58
  69. br label %2, !dbg !60
  70.  
  71. ; <label>:11 ; preds = %2
  72. ret i8* null, !dbg !61
  73. }
  74.  
  75. ; Function Attrs: nounwind uwtable
  76. define i32 @main() #0 !dbg !16 {
  77. %1 = alloca i32, align 4
  78. %threads = alloca [2 x i64], align 16
  79. %attr = alloca %union.pthread_attr_t, align 8
  80. %status = alloca i8*, align 8
  81. store i32 0, i32* %1, align 4
  82. call void @llvm.dbg.declare(metadata [2 x i64]* %threads, metadata !62, metadata !26), !dbg !69
  83. call void @llvm.dbg.declare(metadata %union.pthread_attr_t* %attr, metadata !70, metadata !26), !dbg !81
  84. call void @llvm.dbg.declare(metadata i8** %status, metadata !82, metadata !26), !dbg !83
  85. %2 = call i32 @pthread_attr_init(%union.pthread_attr_t* %attr) #4, !dbg !84
  86. %3 = call i32 @pthread_attr_setdetachstate(%union.pthread_attr_t* %attr, i32 0) #4, !dbg !85
  87. %4 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 0, !dbg !86
  88. %5 = call i32 @pthread_create(i64* %4, %union.pthread_attr_t* null, i8* (i8*)* @increment, i8* inttoptr (i64 1 to i8*)) #4, !dbg !87
  89. %6 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 1, !dbg !88
  90. %7 = call i32 @pthread_create(i64* %6, %union.pthread_attr_t* null, i8* (i8*)* @decrement, i8* inttoptr (i64 2 to i8*)) #4, !dbg !89
  91. %8 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 0, !dbg !90
  92. %9 = load i64, i64* %8, align 16, !dbg !90
  93. %10 = call i32 @pthread_join(i64 %9, i8** %status), !dbg !91
  94. %11 = getelementptr inbounds [2 x i64], [2 x i64]* %threads, i64 0, i64 1, !dbg !92
  95. %12 = load i64, i64* %11, align 8, !dbg !92
  96. %13 = call i32 @pthread_join(i64 %12, i8** %status), !dbg !93
  97. %14 = load i32, i32* @x, align 4, !dbg !94
  98. %15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %14), !dbg !95
  99. ret i32 0, !dbg !96
  100. }
  101.  
  102. ; Function Attrs: nounwind
  103. declare i32 @pthread_attr_init(%union.pthread_attr_t*) #2
  104.  
  105. ; Function Attrs: nounwind
  106. declare i32 @pthread_attr_setdetachstate(%union.pthread_attr_t*, i32) #2
  107.  
  108. ; Function Attrs: nounwind
  109. declare i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*) #2
  110.  
  111. declare i32 @pthread_join(i64, i8**) #3
  112.  
  113. declare i32 @printf(i8*, ...) #3
  114.  
  115. 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" }
  116. attributes #1 = { nounwind readnone }
  117. 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" }
  118. 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" }
  119. attributes #4 = { nounwind }
  120.  
  121. !llvm.dbg.cu = !{!0}
  122. !llvm.module.flags = !{!22, !23}
  123. !llvm.ident = !{!24}
  124.  
  125. !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)
  126. !1 = !DIFile(filename: "example.c", directory: "/home/michael")
  127. !2 = !{!3}
  128. !3 = !DICompositeType(tag: DW_TAG_enumeration_type, file: !4, line: 32, size: 32, align: 32, elements: !5)
  129. !4 = !DIFile(filename: "/usr/include/pthread.h", directory: "/home/michael")
  130. !5 = !{!6, !7}
  131. !6 = !DIEnumerator(name: "PTHREAD_CREATE_JOINABLE", value: 0)
  132. !7 = !DIEnumerator(name: "PTHREAD_CREATE_DETACHED", value: 1)
  133. !8 = !{!9}
  134. !9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64, align: 64)
  135. !10 = !{!11, !15, !16}
  136. !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)
  137. !12 = !DISubroutineType(types: !13)
  138. !13 = !{!9, !9}
  139. !14 = !{}
  140. !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)
  141. !16 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 23, type: !17, isLocal: false, isDefinition: true, scopeLine: 23, isOptimized: false, variables: !14)
  142. !17 = !DISubroutineType(types: !18)
  143. !18 = !{!19}
  144. !19 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  145. !20 = !{!21}
  146. !21 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 7, type: !19, isLocal: false, isDefinition: true, variable: i32* @x)
  147. !22 = !{i32 2, !"Dwarf Version", i32 4}
  148. !23 = !{i32 2, !"Debug Info Version", i32 3}
  149. !24 = !{!"clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)"}
  150. !25 = !DILocalVariable(name: "threadid", arg: 1, scope: !11, file: !1, line: 9, type: !9)
  151. !26 = !DIExpression()
  152. !27 = !DILocation(line: 9, column: 23, scope: !11)
  153. !28 = !DILocalVariable(name: "i", scope: !29, file: !1, line: 10, type: !19)
  154. !29 = distinct !DILexicalBlock(scope: !11, file: !1, line: 10, column: 4)
  155. !30 = !DILocation(line: 10, column: 13, scope: !29)
  156. !31 = !DILocation(line: 10, column: 9, scope: !29)
  157. !32 = !DILocation(line: 10, column: 20, scope: !33)
  158. !33 = !DILexicalBlockFile(scope: !34, file: !1, discriminator: 1)
  159. !34 = distinct !DILexicalBlock(scope: !29, file: !1, line: 10, column: 4)
  160. !35 = !DILocation(line: 10, column: 22, scope: !33)
  161. !36 = !DILocation(line: 10, column: 4, scope: !33)
  162. !37 = !DILocation(line: 11, column: 7, scope: !38)
  163. !38 = distinct !DILexicalBlock(scope: !34, file: !1, line: 10, column: 39)
  164. !39 = !DILocation(line: 12, column: 5, scope: !38)
  165. !40 = !DILocation(line: 10, column: 36, scope: !41)
  166. !41 = !DILexicalBlockFile(scope: !34, file: !1, discriminator: 2)
  167. !42 = !DILocation(line: 10, column: 4, scope: !41)
  168. !43 = !DILocation(line: 13, column: 7, scope: !11)
  169. !44 = !DILocalVariable(name: "threadid", arg: 1, scope: !15, file: !1, line: 16, type: !9)
  170. !45 = !DILocation(line: 16, column: 23, scope: !15)
  171. !46 = !DILocalVariable(name: "i", scope: !47, file: !1, line: 17, type: !19)
  172. !47 = distinct !DILexicalBlock(scope: !15, file: !1, line: 17, column: 4)
  173. !48 = !DILocation(line: 17, column: 13, scope: !47)
  174. !49 = !DILocation(line: 17, column: 9, scope: !47)
  175. !50 = !DILocation(line: 17, column: 20, scope: !51)
  176. !51 = !DILexicalBlockFile(scope: !52, file: !1, discriminator: 1)
  177. !52 = distinct !DILexicalBlock(scope: !47, file: !1, line: 17, column: 4)
  178. !53 = !DILocation(line: 17, column: 22, scope: !51)
  179. !54 = !DILocation(line: 17, column: 4, scope: !51)
  180. !55 = !DILocation(line: 18, column: 8, scope: !56)
  181. !56 = distinct !DILexicalBlock(scope: !52, file: !1, line: 17, column: 39)
  182. !57 = !DILocation(line: 19, column: 5, scope: !56)
  183. !58 = !DILocation(line: 17, column: 36, scope: !59)
  184. !59 = !DILexicalBlockFile(scope: !52, file: !1, discriminator: 2)
  185. !60 = !DILocation(line: 17, column: 4, scope: !59)
  186. !61 = !DILocation(line: 20, column: 7, scope: !15)
  187. !62 = !DILocalVariable(name: "threads", scope: !16, file: !1, line: 24, type: !63)
  188. !63 = !DICompositeType(tag: DW_TAG_array_type, baseType: !64, size: 128, align: 64, elements: !67)
  189. !64 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_t", file: !65, line: 60, baseType: !66)
  190. !65 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h", directory: "/home/michael")
  191. !66 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned)
  192. !67 = !{!68}
  193. !68 = !DISubrange(count: 2)
  194. !69 = !DILocation(line: 24, column: 14, scope: !16)
  195. !70 = !DILocalVariable(name: "attr", scope: !16, file: !1, line: 25, type: !71)
  196. !71 = !DIDerivedType(tag: DW_TAG_typedef, name: "pthread_attr_t", file: !65, line: 69, baseType: !72)
  197. !72 = !DICompositeType(tag: DW_TAG_union_type, name: "pthread_attr_t", file: !65, line: 63, size: 448, align: 64, elements: !73)
  198. !73 = !{!74, !79}
  199. !74 = !DIDerivedType(tag: DW_TAG_member, name: "__size", scope: !72, file: !65, line: 65, baseType: !75, size: 448, align: 8)
  200. !75 = !DICompositeType(tag: DW_TAG_array_type, baseType: !76, size: 448, align: 8, elements: !77)
  201. !76 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
  202. !77 = !{!78}
  203. !78 = !DISubrange(count: 56)
  204. !79 = !DIDerivedType(tag: DW_TAG_member, name: "__align", scope: !72, file: !65, line: 66, baseType: !80, size: 64, align: 64)
  205. !80 = !DIBasicType(name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
  206. !81 = !DILocation(line: 25, column: 19, scope: !16)
  207. !82 = !DILocalVariable(name: "status", scope: !16, file: !1, line: 26, type: !9)
  208. !83 = !DILocation(line: 26, column: 10, scope: !16)
  209. !84 = !DILocation(line: 29, column: 4, scope: !16)
  210. !85 = !DILocation(line: 30, column: 4, scope: !16)
  211. !86 = !DILocation(line: 32, column: 20, scope: !16)
  212. !87 = !DILocation(line: 32, column: 4, scope: !16)
  213. !88 = !DILocation(line: 33, column: 20, scope: !16)
  214. !89 = !DILocation(line: 33, column: 4, scope: !16)
  215. !90 = !DILocation(line: 34, column: 17, scope: !16)
  216. !91 = !DILocation(line: 34, column: 4, scope: !16)
  217. !92 = !DILocation(line: 35, column: 17, scope: !16)
  218. !93 = !DILocation(line: 35, column: 4, scope: !16)
  219. !94 = !DILocation(line: 36, column: 19, scope: !16)
  220. !95 = !DILocation(line: 36, column: 4, scope: !16)
  221. !96 = !DILocation(line: 38, column: 4, scope: !16)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement