Skip to content

Instantly share code, notes, and snippets.

@kg
Created November 17, 2023 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kg/532d4704f5b036c19d04cfe73d2495ae to your computer and use it in GitHub Desktop.
Save kg/532d4704f5b036c19d04cfe73d2495ae to your computer and use it in GitHub Desktop.
source_filename = "/app/example.cpp"
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20"
target triple = "wasm32-unknown-emscripten"
%struct.DoubleBox = type { double }
%struct.UlongBox = type { i64 }
@__main_void = hidden alias i32 (), ptr @main
define hidden void @AcceptDouble(DoubleBox)(double %0) #0 !dbg !6 {
%2 = alloca %struct.DoubleBox, align 8
%3 = getelementptr inbounds %struct.DoubleBox, ptr %2, i32 0, i32 0
store double %0, ptr %3, align 8
call void @llvm.dbg.declare(metadata ptr %2, metadata !16, metadata !DIExpression()), !dbg !17
ret void, !dbg !18
}
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
define hidden void @AcceptUlong(UlongBox)(i64 %0) #0 !dbg !19 {
%2 = alloca %struct.UlongBox, align 8
%3 = getelementptr inbounds %struct.UlongBox, ptr %2, i32 0, i32 0
store i64 %0, ptr %3, align 8
call void @llvm.dbg.declare(metadata ptr %2, metadata !29, metadata !DIExpression()), !dbg !30
ret void, !dbg !31
}
define hidden noundef i32 @main() #2 !dbg !32 {
%1 = alloca i32, align 4
%2 = alloca %struct.DoubleBox, align 8
%3 = alloca %struct.UlongBox, align 8
%4 = alloca %struct.DoubleBox, align 8
%5 = alloca %struct.UlongBox, align 8
store i32 0, ptr %1, align 4
call void @llvm.dbg.declare(metadata ptr %2, metadata !36, metadata !DIExpression()), !dbg !37
call void @llvm.memset.p0.i32(ptr align 8 %2, i8 0, i32 8, i1 false), !dbg !37
call void @llvm.dbg.declare(metadata ptr %3, metadata !38, metadata !DIExpression()), !dbg !39
call void @llvm.memset.p0.i32(ptr align 8 %3, i8 0, i32 8, i1 false), !dbg !39
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %4, ptr align 8 %2, i32 8, i1 false), !dbg !40
%6 = getelementptr inbounds %struct.DoubleBox, ptr %4, i32 0, i32 0, !dbg !41
%7 = load double, ptr %6, align 8, !dbg !41
call void @AcceptDouble(DoubleBox)(double %7), !dbg !41
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %5, ptr align 8 %3, i32 8, i1 false), !dbg !42
%8 = getelementptr inbounds %struct.UlongBox, ptr %5, i32 0, i32 0, !dbg !43
%9 = load i64, ptr %8, align 8, !dbg !43
call void @AcceptUlong(UlongBox)(i64 %9), !dbg !43
ret i32 1, !dbg !44
}
declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg) #3
declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #4
attributes #0 = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+mutable-globals,+sign-ext" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+mutable-globals,+sign-ext" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2, !3, !4}
!llvm.ident = !{!5}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 18.0.0 (https://github.com/llvm/llvm-project.git b7a249d26fe61432050df470d23bdea417fda574)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "/app/example.cpp", directory: "/app")
!2 = !{i32 7, !"Dwarf Version", i32 4}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !{i32 1, !"wchar_size", i32 4}
!5 = !{!"clang version 18.0.0 (https://github.com/llvm/llvm-project.git b7a249d26fe61432050df470d23bdea417fda574)"}
!6 = distinct !DISubprogram(name: "AcceptDouble", linkageName: "AcceptDouble(DoubleBox)", scope: !7, file: !7, line: 11, type: !8, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !15)
!7 = !DIFile(filename: "example.cpp", directory: "/app")
!8 = !DISubroutineType(types: !9)
!9 = !{null, !10}
!10 = !DIDerivedType(tag: DW_TAG_typedef, name: "DoubleBox", file: !7, line: 5, baseType: !11)
!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 3, size: 64, flags: DIFlagTypePassByValue, elements: !12, identifier: "_ZTS9DoubleBox")
!12 = !{!13}
!13 = !DIDerivedType(tag: DW_TAG_member, name: "d", scope: !11, file: !7, line: 4, baseType: !14, size: 64)
!14 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
!15 = !{}
!16 = !DILocalVariable(name: "db", arg: 1, scope: !6, file: !7, line: 11, type: !10)
!17 = !DILocation(line: 11, column: 30, scope: !6)
!18 = !DILocation(line: 12, column: 5, scope: !6)
!19 = distinct !DISubprogram(name: "AcceptUlong", linkageName: "AcceptUlong(UlongBox)", scope: !7, file: !7, line: 15, type: !20, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !15)
!20 = !DISubroutineType(types: !21)
!21 = !{null, !22}
!22 = !DIDerivedType(tag: DW_TAG_typedef, name: "UlongBox", file: !7, line: 9, baseType: !23)
!23 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !7, line: 7, size: 64, flags: DIFlagTypePassByValue, elements: !24, identifier: "_ZTS8UlongBox")
!24 = !{!25}
!25 = !DIDerivedType(tag: DW_TAG_member, name: "u", scope: !23, file: !7, line: 8, baseType: !26, size: 64)
!26 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint64_t", file: !27, line: 98, baseType: !28)
!27 = !DIFile(filename: "/opt/compiler-explorer/clang-trunk-20231116/lib/clang/18/include/stdint.h", directory: "")
!28 = !DIBasicType(name: "unsigned long long", size: 64, encoding: DW_ATE_unsigned)
!29 = !DILocalVariable(name: "u", arg: 1, scope: !19, file: !7, line: 15, type: !22)
!30 = !DILocation(line: 15, column: 28, scope: !19)
!31 = !DILocation(line: 16, column: 5, scope: !19)
!32 = distinct !DISubprogram(name: "main", scope: !7, file: !7, line: 19, type: !33, scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !15)
!33 = !DISubroutineType(types: !34)
!34 = !{!35}
!35 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!36 = !DILocalVariable(name: "db", scope: !32, file: !7, line: 20, type: !10)
!37 = !DILocation(line: 20, column: 15, scope: !32)
!38 = !DILocalVariable(name: "ub", scope: !32, file: !7, line: 21, type: !22)
!39 = !DILocation(line: 21, column: 14, scope: !32)
!40 = !DILocation(line: 22, column: 18, scope: !32)
!41 = !DILocation(line: 22, column: 5, scope: !32)
!42 = !DILocation(line: 23, column: 17, scope: !32)
!43 = !DILocation(line: 23, column: 5, scope: !32)
!44 = !DILocation(line: 24, column: 5, scope: !32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment