Created
July 9, 2015 16:21
-
-
Save zrzka/8ce4ab72ad8a87d32c7f to your computer and use it in GitHub Desktop.
Tuples fun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; ModuleID = '-' | |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-apple-macosx10.10" | |
%Si = type <{ i64 }> | |
%VSs5Int32 = type <{ i32 }> | |
%VSs20UnsafeMutablePointer = type <{ i8* }> | |
@_Tv4main9oneSimpleSi = global %Si zeroinitializer, align 8 | |
@_Tv4main8oneTupleSi = global %Si zeroinitializer, align 8 | |
@_Tv4main8twoTupleTSiSi_ = global <{ %Si, %Si }> zeroinitializer, align 8 | |
@_Tv4main10threeTupleTSiSiSi_ = global <{ %Si, %Si, %Si }> zeroinitializer, align 8 | |
@_TZvOSs7Process5_argcVSs5Int32 = external global %VSs5Int32, align 4 | |
@globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5 = external global i64, align 8 | |
@_TZvOSs7Process11_unsafeArgvGVSs20UnsafeMutablePointerGS0_VSs4Int8__ = external global %VSs20UnsafeMutablePointer, align 8 | |
@"_swift_FORCE_LOAD_$_swiftFoundation" = external global i1 | |
@"_swift_FORCE_LOAD_$_swiftFoundation_$_main" = weak hidden constant i1* @"_swift_FORCE_LOAD_$_swiftFoundation" | |
@"_swift_FORCE_LOAD_$_swiftObjectiveC" = external global i1 | |
@"_swift_FORCE_LOAD_$_swiftObjectiveC_$_main" = weak hidden constant i1* @"_swift_FORCE_LOAD_$_swiftObjectiveC" | |
@"_swift_FORCE_LOAD_$_swiftDarwin" = external global i1 | |
@"_swift_FORCE_LOAD_$_swiftDarwin_$_main" = weak hidden constant i1* @"_swift_FORCE_LOAD_$_swiftDarwin" | |
@"_swift_FORCE_LOAD_$_swiftDispatch" = external global i1 | |
@"_swift_FORCE_LOAD_$_swiftDispatch_$_main" = weak hidden constant i1* @"_swift_FORCE_LOAD_$_swiftDispatch" | |
@"_swift_FORCE_LOAD_$_swiftSecurity" = external global i1 | |
@"_swift_FORCE_LOAD_$_swiftSecurity_$_main" = weak hidden constant i1* @"_swift_FORCE_LOAD_$_swiftSecurity" | |
@"_swift_FORCE_LOAD_$_swiftCoreGraphics" = external global i1 | |
@"_swift_FORCE_LOAD_$_swiftCoreGraphics_$_main" = weak hidden constant i1* @"_swift_FORCE_LOAD_$_swiftCoreGraphics" | |
@llvm.used = appending global [10 x i8*] [i8* bitcast (%Si* @_Tv4main9oneSimpleSi to i8*), i8* bitcast (%Si* @_Tv4main8oneTupleSi to i8*), i8* bitcast (<{ %Si, %Si }>* @_Tv4main8twoTupleTSiSi_ to i8*), i8* bitcast (<{ %Si, %Si, %Si }>* @_Tv4main10threeTupleTSiSiSi_ to i8*), i8* bitcast (i1** @"_swift_FORCE_LOAD_$_swiftFoundation_$_main" to i8*), i8* bitcast (i1** @"_swift_FORCE_LOAD_$_swiftObjectiveC_$_main" to i8*), i8* bitcast (i1** @"_swift_FORCE_LOAD_$_swiftDarwin_$_main" to i8*), i8* bitcast (i1** @"_swift_FORCE_LOAD_$_swiftDispatch_$_main" to i8*), i8* bitcast (i1** @"_swift_FORCE_LOAD_$_swiftSecurity_$_main" to i8*), i8* bitcast (i1** @"_swift_FORCE_LOAD_$_swiftCoreGraphics_$_main" to i8*)], section "llvm.metadata", align 8 | |
define i32 @main(i32, i8**) #0 { | |
entry: | |
%2 = bitcast i8** %1 to i8* | |
store i32 %0, i32* getelementptr inbounds (%VSs5Int32* @_TZvOSs7Process5_argcVSs5Int32, i32 0, i32 0), align 4 | |
%3 = load i64* @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5, align 8 | |
%4 = icmp ne i64 %3, -1 | |
br i1 %4, label %once_not_done, label %once_done | |
once_not_done: ; preds = %entry | |
call void @swift_once(i64* @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5, i8* bitcast (void ()* @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5 to i8*)) | |
br label %once_done | |
once_done: ; preds = %once_not_done, %entry | |
store i8* %2, i8** getelementptr inbounds (%VSs20UnsafeMutablePointer* @_TZvOSs7Process11_unsafeArgvGVSs20UnsafeMutablePointerGS0_VSs4Int8__, i32 0, i32 0), align 8 | |
store i64 1, i64* getelementptr inbounds (%Si* @_Tv4main9oneSimpleSi, i32 0, i32 0), align 8 | |
store i64 1, i64* getelementptr inbounds (%Si* @_Tv4main8oneTupleSi, i32 0, i32 0), align 8 | |
store i64 1, i64* getelementptr inbounds (<{ %Si, %Si }>* @_Tv4main8twoTupleTSiSi_, i32 0, i32 0, i32 0), align 8 | |
store i64 2, i64* getelementptr inbounds (<{ %Si, %Si }>* @_Tv4main8twoTupleTSiSi_, i32 0, i32 1, i32 0), align 8 | |
store i64 1, i64* getelementptr inbounds (<{ %Si, %Si, %Si }>* @_Tv4main10threeTupleTSiSiSi_, i32 0, i32 0, i32 0), align 8 | |
store i64 2, i64* getelementptr inbounds (<{ %Si, %Si, %Si }>* @_Tv4main10threeTupleTSiSiSi_, i32 0, i32 1, i32 0), align 8 | |
store i64 3, i64* getelementptr inbounds (<{ %Si, %Si, %Si }>* @_Tv4main10threeTupleTSiSiSi_, i32 0, i32 2, i32 0), align 8 | |
ret i32 0 | |
} | |
declare void @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5() #0 | |
declare void @swift_once(i64*, i8*) | |
attributes #0 = { "target-cpu"="core2" "target-features"="+ssse3,+cx16,+sse,+sse2,+sse3" } | |
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !28, !29} | |
!0 = !{i32 2, !"Dwarf Version", i32 3} | |
!1 = !{i32 1, !"Debug Info Version", i32 700000003} | |
!2 = !{i32 1, !"Objective-C Version", i32 2} | |
!3 = !{i32 1, !"Objective-C Image Info Version", i32 0} | |
!4 = !{i32 1, !"Objective-C Image Info Section", !"__DATA, __objc_imageinfo, regular, no_dead_strip"} | |
!5 = !{i32 4, !"Objective-C Garbage Collection", i32 768} | |
!6 = !{i32 6, !"Linker Options", !7} | |
!7 = !{!8, !9, !10, !11, !12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} | |
!8 = !{!"-lswiftCore"} | |
!9 = !{!"-lswiftFoundation"} | |
!10 = !{!"-framework", !"Foundation"} | |
!11 = !{!"-lswiftObjectiveC"} | |
!12 = !{!"-lswiftDarwin"} | |
!13 = !{!"-framework", !"CoreServices"} | |
!14 = !{!"-framework", !"IOKit"} | |
!15 = !{!"-lswiftDispatch"} | |
!16 = !{!"-framework", !"CoreFoundation"} | |
!17 = !{!"-framework", !"DiskArbitration"} | |
!18 = !{!"-framework", !"CFNetwork"} | |
!19 = !{!"-lswiftSecurity"} | |
!20 = !{!"-framework", !"Security"} | |
!21 = !{!"-lswiftCoreGraphics"} | |
!22 = !{!"-framework", !"CoreGraphics"} | |
!23 = !{!"-framework", !"IOSurface"} | |
!24 = !{!"-framework", !"ApplicationServices"} | |
!25 = !{!"-framework", !"CoreText"} | |
!26 = !{!"-framework", !"ImageIO"} | |
!27 = !{!"-lobjc"} | |
!28 = !{i32 1, !"PIC Level", i32 2} | |
!29 = !{i32 1, !"Swift Version", i32 3} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sil_stage canonical | |
import Builtin | |
import Swift | |
import SwiftShims | |
// main.emptyTuple : () | |
sil_global @_Tv4main10emptyTupleT_ : $() | |
// main.oneSimple : Swift.Int | |
sil_global @_Tv4main9oneSimpleSi : $Int | |
// main.oneTuple : Swift.Int | |
sil_global @_Tv4main8oneTupleSi : $Int | |
// main.twoTuple : (Swift.Int, Swift.Int) | |
sil_global @_Tv4main8twoTupleTSiSi_ : $(Int, Int) | |
// main.threeTuple : (Swift.Int, Swift.Int, Swift.Int) | |
sil_global @_Tv4main10threeTupleTSiSiSi_ : $(Int, Int, Int) | |
// static Swift.Process._argc : Swift.Int32 | |
sil_global [fragile] @_TZvOSs7Process5_argcVSs5Int32 : $Int32 | |
// globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5 | |
sil_global private_external [fragile] @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5 : $Builtin.Word | |
// static Swift.Process._unsafeArgv : Swift.UnsafeMutablePointer<Swift.UnsafeMutablePointer<Swift.Int8>> | |
sil_global [fragile] @_TZvOSs7Process11_unsafeArgvGVSs20UnsafeMutablePointerGS0_VSs4Int8__ : $UnsafeMutablePointer<UnsafeMutablePointer<Int8>> | |
// main | |
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<UnsafeMutablePointer<Int8>>) -> Int32 { | |
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<UnsafeMutablePointer<Int8>>): | |
%2 = global_addr @_TZvOSs7Process5_argcVSs5Int32 : $*Int32 // user: %3 | |
store %0 to %2 : $*Int32 // id: %3 | |
%4 = global_addr @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5 : $*Builtin.Word // user: %5 | |
%5 = address_to_pointer %4 : $*Builtin.Word to $Builtin.RawPointer // user: %7 | |
// function_ref globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5 | |
%6 = function_ref @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5 : $@convention(thin) () -> () // user: %7 | |
%7 = builtin "once"(%5 : $Builtin.RawPointer, %6 : $@convention(thin) () -> ()) : $() | |
%8 = global_addr @_TZvOSs7Process11_unsafeArgvGVSs20UnsafeMutablePointerGS0_VSs4Int8__ : $*UnsafeMutablePointer<UnsafeMutablePointer<Int8>> // user: %9 | |
store %1 to %8 : $*UnsafeMutablePointer<UnsafeMutablePointer<Int8>> // id: %9 | |
%10 = tuple () | |
%11 = global_addr @_Tv4main10emptyTupleT_ : $*() | |
%12 = global_addr @_Tv4main9oneSimpleSi : $*Int // user: %15 | |
%13 = integer_literal $Builtin.Int64, 1 // user: %14 | |
%14 = struct $Int (%13 : $Builtin.Int64) // user: %15 | |
store %14 to %12 : $*Int // id: %15 | |
%16 = global_addr @_Tv4main8oneTupleSi : $*Int // user: %19 | |
%17 = integer_literal $Builtin.Int64, 1 // user: %18 | |
%18 = struct $Int (%17 : $Builtin.Int64) // user: %19 | |
store %18 to %16 : $*Int // id: %19 | |
%20 = global_addr @_Tv4main8twoTupleTSiSi_ : $*(Int, Int) // users: %21, %22 | |
%21 = tuple_element_addr %20 : $*(Int, Int), 0 // user: %25 | |
%22 = tuple_element_addr %20 : $*(Int, Int), 1 // user: %28 | |
%23 = integer_literal $Builtin.Int64, 1 // user: %24 | |
%24 = struct $Int (%23 : $Builtin.Int64) // user: %25 | |
store %24 to %21 : $*Int // id: %25 | |
%26 = integer_literal $Builtin.Int64, 2 // user: %27 | |
%27 = struct $Int (%26 : $Builtin.Int64) // user: %28 | |
store %27 to %22 : $*Int // id: %28 | |
%29 = global_addr @_Tv4main10threeTupleTSiSiSi_ : $*(Int, Int, Int) // users: %30, %31, %32 | |
%30 = tuple_element_addr %29 : $*(Int, Int, Int), 0 // user: %35 | |
%31 = tuple_element_addr %29 : $*(Int, Int, Int), 1 // user: %38 | |
%32 = tuple_element_addr %29 : $*(Int, Int, Int), 2 // user: %41 | |
%33 = integer_literal $Builtin.Int64, 1 // user: %34 | |
%34 = struct $Int (%33 : $Builtin.Int64) // user: %35 | |
store %34 to %30 : $*Int // id: %35 | |
%36 = integer_literal $Builtin.Int64, 2 // user: %37 | |
%37 = struct $Int (%36 : $Builtin.Int64) // user: %38 | |
store %37 to %31 : $*Int // id: %38 | |
%39 = integer_literal $Builtin.Int64, 3 // user: %40 | |
%40 = struct $Int (%39 : $Builtin.Int64) // user: %41 | |
store %40 to %32 : $*Int // id: %41 | |
%42 = integer_literal $Builtin.Int32, 0 // user: %43 | |
%43 = struct $Int32 (%42 : $Builtin.Int32) // user: %44 | |
return %43 : $Int32 // id: %44 | |
} | |
// Swift._didEnterMain (Swift.Int32, argv : Swift.UnsafeMutablePointer<Swift.UnsafeMutablePointer<Swift.Int8>>) -> () | |
sil [transparent] [fragile] @_TFSs13_didEnterMainFTVSs5Int324argvGVSs20UnsafeMutablePointerGS0_VSs4Int8___T_ : $@convention(thin) (Int32, UnsafeMutablePointer<UnsafeMutablePointer<Int8>>) -> () | |
// Swift.Int.init (Swift.Int.Type)(_builtinIntegerLiteral : Builtin.Int2048) -> Swift.Int | |
sil [transparent] [fragile] @_TFSiCfMSiFT22_builtinIntegerLiteralBi2048__Si : $@convention(thin) (Builtin.Int2048, @thin Int.Type) -> Int | |
// globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5 | |
sil private_external [fragile] @globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5 : $@convention(thin) () -> () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let emptyTuple = () | |
let oneSimple = 1 | |
let oneTuple = (1) | |
let twoTuple = (1,2) | |
let threeTuple = (1,2,3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment