Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created November 14, 2019 14:00
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 nikomatsakis/44fb90f7bb97e14735855f7fd3dc3192 to your computer and use it in GitHub Desktop.
Save nikomatsakis/44fb90f7bb97e14735855f7fd3dc3192 to your computer and use it in GitHub Desktop.
; ModuleID = '31e3415mrsire8w'
source_filename = "31e3415mrsire8w"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"unwind::libunwind::_Unwind_Exception" = type { [0 x i64], i64, [0 x i64], void (i32, %"unwind::libunwind::_Unwind_Exception"*)*, [0 x i64], [6 x i64], [0 x i64] }
%"unwind::libunwind::_Unwind_Context" = type { [0 x i8] }
@__rustc_debug_gdb_scripts_section__ = linkonce_odr unnamed_addr constant [34 x i8] c"\01gdb_load_rust_pretty_printers.py\00", section ".debug_gdb_scripts", align 1
; Function Attrs: nounwind nonlazybind
define i32 @double_input(i32) unnamed_addr #0 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality !dbg !6 {
start:
%1 = alloca { i8*, i32 }, align 8
%input = alloca i32, align 4
store i32 %0, i32* %input, align 4
call void @llvm.dbg.declare(metadata i32* %input, metadata !11, metadata !DIExpression()), !dbg !12
%_2 = load i32, i32* %input, align 4, !dbg !13
%2 = invoke i32 @triple_input(i32 %_2)
to label %bb1 unwind label %cleanup, !dbg !15
bb1: ; preds = %start
ret i32 %2, !dbg !16
bb2: ; preds = %cleanup
call void @llvm.trap(), !dbg !17
unreachable, !dbg !17
cleanup: ; preds = %start
%3 = landingpad { i8*, i32 }
cleanup
%4 = extractvalue { i8*, i32 } %3, 0
%5 = extractvalue { i8*, i32 } %3, 1
%6 = getelementptr inbounds { i8*, i32 }, { i8*, i32 }* %1, i32 0, i32 0
store i8* %4, i8** %6, align 8
%7 = getelementptr inbounds { i8*, i32 }, { i8*, i32 }* %1, i32 0, i32 1
store i32 %5, i32* %7, align 8
br label %bb2
}
; Function Attrs: nounwind nonlazybind
declare i32 @rust_eh_personality(i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr #0
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: nounwind nonlazybind
declare i32 @triple_input(i32) unnamed_addr #0
; Function Attrs: cold noreturn nounwind
declare void @llvm.trap() #2
attributes #0 = { nounwind nonlazybind "probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
attributes #1 = { nounwind readnone speculatable }
attributes #2 = { cold noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2}
!llvm.dbg.cu = !{!3}
!0 = !{i32 7, !"PIC Level", i32 2}
!1 = !{i32 2, !"RtLibUseGOT", i32 1}
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !4, producer: "clang LLVM (rustc version 1.41.0-dev)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5)
!4 = !DIFile(filename: "src/lib.rs", directory: "/home/nmatsakis/versioned/rust-ffi-examples/cpp-to-rust")
!5 = !{}
!6 = distinct !DISubprogram(name: "double_input", linkageName: "double_input", scope: !7, file: !4, line: 8, type: !8, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !3, templateParams: !5, retainedNodes: !5)
!7 = !DINamespace(name: "double_input", scope: null)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10}
!10 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed)
!11 = !DILocalVariable(name: "input", arg: 1, scope: !6, file: !4, line: 8, type: !10)
!12 = !DILocation(line: 8, column: 27, scope: !6)
!13 = !DILocation(line: 9, column: 26, scope: !14)
!14 = distinct !DILexicalBlock(scope: !6, file: !4, line: 9, column: 4)
!15 = !DILocation(line: 9, column: 13, scope: !14)
!16 = !DILocation(line: 10, column: 1, scope: !6)
!17 = !DILocation(line: 8, scope: !6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment