Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created March 1, 2017 15:18
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 rhysd/c11b0ae3d378abb3a89fabdef591aab8 to your computer and use it in GitHub Desktop.
Save rhysd/c11b0ae3d378abb3a89fabdef591aab8 to your computer and use it in GitHub Desktop.
; ModuleID = 'foo.ml'
source_filename = "foo.ml"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin16.4.0"
; コード:
; let rec f x = x + x in
; println_int (f 42)
; Function Attrs: nounwind
declare i8* @GC_malloc(i64) #0
; Function Attrs: nounwind
declare void @GC_init() #0
declare void @println_int(i64) #1
; Function Attrs: inlinehint nounwind ssp uwtable
define i64 @"f$t1"(i64 %"x$t2") #2 !dbg !3 {
entry:
%add = add i64 %"x$t2", %"x$t2", !dbg !7
ret i64 %add, !dbg !7
}
; Function Attrs: ssp uwtable
define i32 @main() #3 !dbg !8 {
entry:
call void @GC_init(), !dbg !11
%0 = call i64 @"f$t1"(i64 42), !dbg !12
call void @println_int(i64 %0), !dbg !13
ret i32 0, !dbg !13
}
attributes #0 = { nounwind }
attributes #1 = { "disable-tail-calls"="false" }
attributes #2 = { inlinehint nounwind ssp uwtable "disable-tail-calls"="false" }
attributes #3 = { ssp uwtable "disable-tail-calls"="false" }
!llvm.dbg.cu = !{!0}
!0 = distinct !DICompileUnit(language: 57005, file: !1, producer: "gocaml", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "foo.ml", directory: "/Users/rhysd/.go/src/github.com/rhysd/gocaml")
!2 = !{}
!3 = distinct !DISubprogram(name: "f$t1", linkageName: "f$t1", scope: null, line: 1, type: !4, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
!4 = !DISubroutineType(types: !5)
!5 = !{!6, !6}
!6 = !DIBasicType(name: "int", size: 64, encoding: DW_ATE_signed)
!7 = !DILocation(line: 1, column: 15, scope: !3)
!8 = distinct !DISubprogram(name: "main", linkageName: "main", scope: null, line: 2, type: !9, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, variables: !2)
!9 = !DISubroutineType(types: !10)
!10 = !{null}
!11 = !DILocation(line: 2, column: 16, scope: !8)
!12 = !DILocation(line: 2, column: 14, scope: !8)
!13 = !DILocation(line: 2, column: 1, scope: !8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment