Skip to content

Instantly share code, notes, and snippets.

@lewurm
Created February 18, 2022 11:05
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 lewurm/1a8c5652d4cc99d8b2ffcfa021d38580 to your computer and use it in GitHub Desktop.
Save lewurm/1a8c5652d4cc99d8b2ffcfa021d38580 to your computer and use it in GitHub Desktop.
; ModuleID = 'hello'
source_filename = "ld-temp.o"
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx12.0.0"
%0 = type opaque
%struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* }
%struct._objc_cache = type opaque
%struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* }
%struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] }
%struct._objc_method = type { i8*, i8*, i8* }
%struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] }
%struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32, i8**, i8*, %struct._prop_list_t* }
%struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] }
%struct._ivar_t = type { i64*, i8*, i8*, i32, i32 }
%struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] }
%struct._prop_t = type { i8*, i8* }
%struct.__NSConstantString_tag = type { i32*, i32, i8*, i64 }
@llvm.compiler.used = appending global [7 x i8*] [i8* bitcast (%struct._class_t** @"OBJC_CLASSLIST_REFERENCES_$_" to i8*), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @OBJC_METH_VAR_NAME_, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @OBJC_METH_VAR_NAME_.1, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @OBJC_METH_VAR_NAME_.3, i32 0, i32 0), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_ to i8*), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.2 to i8*), i8* bitcast (i8** @OBJC_SELECTOR_REFERENCES_.4 to i8*)], section "llvm.metadata"
@"OBJC_CLASSLIST_REFERENCES_$_" = internal global %struct._class_t* @"OBJC_CLASS_$_NSProcessInfo", section "__DATA,__objc_classrefs,regular,no_dead_strip", align 8
@OBJC_METH_VAR_NAME_ = private unnamed_addr constant [12 x i8] c"processInfo\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_METH_VAR_NAME_.1 = private unnamed_addr constant [23 x i8] c"operatingSystemVersion\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_METH_VAR_NAME_.3 = private unnamed_addr constant [20 x i8] c"respondsToSelector:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@OBJC_SELECTOR_REFERENCES_ = internal externally_initialized global i8* getelementptr inbounds ([12 x i8], [12 x i8]* @OBJC_METH_VAR_NAME_, i64 0, i64 0), section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip", align 8
@OBJC_SELECTOR_REFERENCES_.2 = internal externally_initialized global i8* getelementptr inbounds ([23 x i8], [23 x i8]* @OBJC_METH_VAR_NAME_.1, i64 0, i64 0), section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip", align 8
@OBJC_SELECTOR_REFERENCES_.4 = internal externally_initialized global i8* getelementptr inbounds ([20 x i8], [20 x i8]* @OBJC_METH_VAR_NAME_.3, i64 0, i64 0), section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip", align 8
@"OBJC_CLASS_$_NSProcessInfo" = external global %struct._class_t
@_unnamed_cfstring_ = private global %struct.__NSConstantString_tag { i32* getelementptr inbounds ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0), i64 12 }, section "__DATA,__cfstring", align 8 #0
@_unnamed_cfstring_.8 = private global %struct.__NSConstantString_tag { i32* getelementptr inbounds ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i32 0, i32 0), i64 24 }, section "__DATA,__cfstring", align 8 #0
@_unnamed_cfstring_.6 = private global %struct.__NSConstantString_tag { i32* getelementptr inbounds ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i32 0, i32 0), i64 22 }, section "__DATA,__cfstring", align 8 #0
@__CFConstantStringClassReference = external global [0 x i32]
@.str.5 = private unnamed_addr constant [23 x i8] c"i am in your if branch\00", section "__TEXT,__cstring,cstring_literals", align 1
@.str.7 = private unnamed_addr constant [25 x i8] c"i am in your else branch\00", section "__TEXT,__cstring,cstring_literals", align 1
@.str = private unnamed_addr constant [13 x i8] c"Hello World!\00", section "__TEXT,__cstring,cstring_literals", align 1
; Function Attrs: ssp uwtable
define dso_local i32 @main(i32 %0, i8** nocapture readnone %1) local_unnamed_addr #1 !dbg !14 {
call void @llvm.dbg.value(metadata i32 %0, metadata !22, metadata !DIExpression()), !dbg !24
call void @llvm.dbg.value(metadata i8** %1, metadata !23, metadata !DIExpression()), !dbg !24
notail call void (i8*, ...) @NSLog(i8* bitcast (%struct.__NSConstantString_tag* @_unnamed_cfstring_ to i8*)), !dbg !25
%3 = load i8*, i8** bitcast (%struct._class_t** @"OBJC_CLASSLIST_REFERENCES_$_" to i8**), align 8, !dbg !26
%4 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_, align 8, !dbg !26, !invariant.load !2
%5 = call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*)*)(i8* %3, i8* %4), !dbg !26
%6 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.2, align 8, !dbg !28, !invariant.load !2
%7 = load i8*, i8** @OBJC_SELECTOR_REFERENCES_.4, align 8, !dbg !29, !invariant.load !2
%8 = bitcast %0* %5 to i8*, !dbg !29
%9 = call signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, i8*)*)(i8* %8, i8* %7, i8* %6), !dbg !29
%10 = icmp eq i8 %9, 0, !dbg !29
%11 = select i1 %10, i8* bitcast (%struct.__NSConstantString_tag* @_unnamed_cfstring_.8 to i8*), i8* bitcast (%struct.__NSConstantString_tag* @_unnamed_cfstring_.6 to i8*), !dbg !30
notail call void (i8*, ...) @NSLog(i8* %11), !dbg !31
ret i32 0, !dbg !32
}
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
declare void @NSLog(i8*, ...) local_unnamed_addr #3
; Function Attrs: nonlazybind
declare i8* @objc_msgSend(i8*, i8*, ...) local_unnamed_addr #4
attributes #0 = { "objc_arc_inert" }
attributes #1 = { ssp uwtable "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"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nofree nosync nounwind readnone speculatable willreturn }
attributes #3 = { "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"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #4 = { nonlazybind }
!llvm.dbg.cu = !{!0}
!llvm.ident = !{!3}
!llvm.module.flags = !{!4, !5, !6, !7, !8, !9, !10, !11, !12, !13}
!0 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !1, producer: "clang version 12.0.1 (GraalVM.org llvmorg-12.0.1-3-g6e0a5672bc-bgf11ed69a5a 6434d6e29810f2b52bf1c56e99bc0b9e7d79d432)", isOptimized: true, runtimeVersion: 2, emissionKind: FullDebug, enums: !2, nameTableKind: None, sysroot: "/Applications/Xcode13.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk", sdk: "MacOSX.sdk")
!1 = !DIFile(filename: "hello.m", directory: "/Users/lewurm/work/x86/graal/espresso", checksumkind: CSK_MD5, checksum: "58dd2c5354e308e349237c7fa9605589")
!2 = !{}
!3 = !{!"clang version 12.0.1 (GraalVM.org llvmorg-12.0.1-3-g6e0a5672bc-bgf11ed69a5a 6434d6e29810f2b52bf1c56e99bc0b9e7d79d432)"}
!4 = !{i32 2, !"SDK Version", [2 x i32] [i32 12, i32 1]}
!5 = !{i32 1, !"Objective-C Version", i32 2}
!6 = !{i32 1, !"Objective-C Image Info Version", i32 0}
!7 = !{i32 1, !"Objective-C Image Info Section", !"__DATA,__objc_imageinfo,regular,no_dead_strip"}
!8 = !{i32 1, !"Objective-C Garbage Collection", i8 0}
!9 = !{i32 1, !"Objective-C Class Properties", i32 64}
!10 = !{i32 7, !"Dwarf Version", i32 5}
!11 = !{i32 2, !"Debug Info Version", i32 3}
!12 = !{i32 1, !"wchar_size", i32 4}
!13 = !{i32 7, !"PIC Level", i32 2}
!14 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !15, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !21)
!15 = !DISubroutineType(types: !16)
!16 = !{!17, !17, !18}
!17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!21 = !{!22, !23}
!22 = !DILocalVariable(name: "argc", arg: 1, scope: !14, file: !1, line: 3, type: !17)
!23 = !DILocalVariable(name: "argv", arg: 2, scope: !14, file: !1, line: 3, type: !18)
!24 = !DILocation(line: 0, scope: !14)
!25 = !DILocation(line: 4, column: 5, scope: !14)
!26 = !DILocation(line: 5, column: 10, scope: !27)
!27 = distinct !DILexicalBlock(scope: !14, file: !1, line: 5, column: 9)
!28 = !DILocation(line: 5, column: 57, scope: !27)
!29 = !DILocation(line: 5, column: 9, scope: !27)
!30 = !DILocation(line: 5, column: 9, scope: !14)
!31 = !DILocation(line: 0, scope: !27)
!32 = !DILocation(line: 10, column: 1, scope: !14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment