Skip to content

Instantly share code, notes, and snippets.

@Keno
Created February 25, 2021 17:23
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 Keno/99c49ee7f3e4f262e5ae8551dbc585fa to your computer and use it in GitHub Desktop.
Save Keno/99c49ee7f3e4f262e5ae8551dbc585fa to your computer and use it in GitHub Desktop.
~/llvm-project-build/bin/llc -mtriple arm64-apple-darwin20.0.0 -mcpu apple-a12 -code-model=small -O0 -fast-isel -o - x.ll
; ModuleID = 'f'
source_filename = "f"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-darwin20.0.0"
@llvm.compiler.used = appending global [3 x i8*] [i8* bitcast (void ({}*)* @jl_gc_queue_root to i8*), i8* bitcast ({}* (i8*, i32, i32)* @jl_gc_pool_alloc to i8*), i8* bitcast ({}* (i8*, i64)* @jl_gc_big_alloc to i8*)], section "llvm.metadata"
; @ REPL[15]:1 within `f'
; Function Attrs: sspstrong
define nonnull {}* @julia_f_1854(i32 signext %0) #0 !dbg !5 {
top:
%1 = call {}*** inttoptr (i64 4347167220 to {}*** ()*)() #5
%2 = bitcast {}*** %1 to {}**
%3 = getelementptr inbounds {}*, {}** %2, i64 4
%4 = bitcast {}** %3 to i64**
%5 = bitcast {}*** %1 to i64*
%6 = getelementptr inbounds i64, i64* %5, i64 1
%n = alloca i32, align 4
store i32 %0, i32* %n, align 4
call void @llvm.dbg.declare(metadata i32* %n, metadata !17, metadata !DIExpression()), !dbg !18
; @ REPL[15]:2 within `f'
call void inttoptr (i64 4342098656 to void ()*)(), !dbg !19
; ┌ @ intfuncs.jl:743 within `split_sign'
; │┌ @ int.jl:172 within `abs'
; ││┌ @ int.jl:132 within `flipsign'
%7 = ashr i32 %0, 31, !dbg !20
%8 = add i32 %0, %7, !dbg !20
%9 = xor i32 %8, %7, !dbg !20
; │└└
; │┌ @ promotion.jl:360 within `<'
; ││┌ @ promotion.jl:291 within `promote'
; │││┌ @ promotion.jl:268 within `_promote'
; ││││┌ @ number.jl:7 within `convert'
; │││││┌ @ boot.jl:757 within `Int64'
; ││││││┌ @ boot.jl:676 within `toInt64'
%10 = sext i32 %0 to i64, !dbg !29
; ││└└└└└
; ││ @ promotion.jl:360 within `<' @ int.jl:83
%11 = icmp slt i64 %10, 0, !dbg !44
; └└
; @ REPL[15]:3 within `f'
%12 = zext i1 %11 to i8, !dbg !46
%13 = call nonnull {}* @j_dec_1856(i32 zeroext %9, i64 signext 1, i8 zeroext %12), !dbg !46
ret {}* %13, !dbg !46
}
define nonnull {}* @jfptr_f_1855({}* %0, {}** %1, i32 %2) #1 {
top:
%3 = call {}*** inttoptr (i64 4347167220 to {}*** ()*)() #5
%4 = bitcast {}*** %3 to {}**
%5 = getelementptr inbounds {}*, {}** %4, i64 4
%6 = bitcast {}** %5 to i64**
%7 = load {}*, {}** %1, align 8, !nonnull !4, !dereferenceable !47, !align !47
%8 = bitcast {}* %7 to i32*
%9 = load i32, i32* %8, align 4
%10 = call nonnull {}* @julia_f_1854(i32 signext %9)
ret {}* %10
}
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
declare nonnull {}* @j_dec_1856(i32 zeroext, i64 signext, i8 zeroext)
; Function Attrs: inaccessiblemem_or_argmemonly
declare void @jl_gc_queue_root({}*) #3
; Function Attrs: allocsize(1)
declare noalias nonnull {}* @jl_gc_pool_alloc(i8*, i32, i32) #4
; Function Attrs: allocsize(1)
declare noalias nonnull {}* @jl_gc_big_alloc(i8*, i64) #4
attributes #0 = { sspstrong }
attributes #1 = { "thunk" }
attributes #2 = { nounwind readnone speculatable willreturn }
attributes #3 = { inaccessiblemem_or_argmemonly }
attributes #4 = { allocsize(1) }
attributes #5 = { nounwind readnone }
!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 1, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, nameTableKind: GNU)
!3 = !DIFile(filename: "REPL[15]", directory: ".")
!4 = !{}
!5 = distinct !DISubprogram(name: "f", linkageName: "julia_f_1854", scope: null, file: !3, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !15)
!6 = !DISubroutineType(types: !7)
!7 = !{!8, !13, !14}
!8 = !DIDerivedType(tag: DW_TAG_typedef, name: "String", baseType: !9)
!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, align: 64)
!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "jl_value_t", file: !11, line: 71, align: 64, elements: !12)
!11 = !DIFile(filename: "julia.h", directory: "")
!12 = !{!9}
!13 = !DICompositeType(tag: DW_TAG_structure_type, name: "#f", align: 8, elements: !4, runtimeLang: DW_LANG_Julia, identifier: "4555778000")
!14 = !DIBasicType(name: "Int32", size: 32, encoding: DW_ATE_unsigned)
!15 = !{!16, !17}
!16 = !DILocalVariable(name: "#self#", arg: 1, scope: !5, file: !3, line: 1, type: !13)
!17 = !DILocalVariable(name: "n", arg: 2, scope: !5, file: !3, line: 1, type: !14)
!18 = !DILocation(line: 1, scope: !5)
!19 = !DILocation(line: 2, scope: !5)
!20 = !DILocation(line: 132, scope: !21, inlinedAt: !24)
!21 = distinct !DISubprogram(name: "flipsign;", linkageName: "flipsign", scope: !22, file: !22, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!22 = !DIFile(filename: "int.jl", directory: ".")
!23 = !DISubroutineType(types: !4)
!24 = !DILocation(line: 172, scope: !25, inlinedAt: !26)
!25 = distinct !DISubprogram(name: "abs;", linkageName: "abs", scope: !22, file: !22, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!26 = !DILocation(line: 743, scope: !27, inlinedAt: !19)
!27 = distinct !DISubprogram(name: "split_sign;", linkageName: "split_sign", scope: !28, file: !28, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!28 = !DIFile(filename: "intfuncs.jl", directory: ".")
!29 = !DILocation(line: 676, scope: !30, inlinedAt: !32)
!30 = distinct !DISubprogram(name: "toInt64;", linkageName: "toInt64", scope: !31, file: !31, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!31 = !DIFile(filename: "boot.jl", directory: ".")
!32 = !DILocation(line: 757, scope: !33, inlinedAt: !34)
!33 = distinct !DISubprogram(name: "Int64;", linkageName: "Int64", scope: !31, file: !31, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!34 = !DILocation(line: 7, scope: !35, inlinedAt: !37)
!35 = distinct !DISubprogram(name: "convert;", linkageName: "convert", scope: !36, file: !36, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!36 = !DIFile(filename: "number.jl", directory: ".")
!37 = !DILocation(line: 268, scope: !38, inlinedAt: !40)
!38 = distinct !DISubprogram(name: "_promote;", linkageName: "_promote", scope: !39, file: !39, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!39 = !DIFile(filename: "promotion.jl", directory: ".")
!40 = !DILocation(line: 291, scope: !41, inlinedAt: !42)
!41 = distinct !DISubprogram(name: "promote;", linkageName: "promote", scope: !39, file: !39, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!42 = !DILocation(line: 360, scope: !43, inlinedAt: !26)
!43 = distinct !DISubprogram(name: "<;", linkageName: "<", scope: !39, file: !39, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!44 = !DILocation(line: 83, scope: !45, inlinedAt: !42)
!45 = distinct !DISubprogram(name: "<;", linkageName: "<", scope: !22, file: !22, type: !23, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
!46 = !DILocation(line: 3, scope: !5)
!47 = !{i64 4}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment