Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created July 10, 2017 17:22
Show Gist options
  • Save alexcrichton/648fb55a7f1a501a5b8b88fb7b8c3d7c to your computer and use it in GitHub Desktop.
Save alexcrichton/648fb55a7f1a501a5b8b88fb7b8c3d7c to your computer and use it in GitHub Desktop.
#![crate_type = "rlib"]
pub fn bar() {}
; ModuleID = 'foo.cgu-0.rs'
source_filename = "foo.cgu-0.rs"
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 { i64, [0 x i8], void (i32, %"unwind::libunwind::_Unwind_Exception"*)*, [0 x i8], [6 x i64], [0 x i8] }
%"unwind::libunwind::_Unwind_Context" = type {}
; foo::A::foo1
; Function Attrs: uwtable
define internal void @_ZN3foo1A4foo117hcfa03453b669bd94E(i32) unnamed_addr #0 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
start:
%personalityslot = alloca { i8*, i32 }
; invoke bar::bar
invoke void @_ZN3bar3bar17h21868f3a4452d05bE()
to label %bb3 unwind label %cleanup
bb1: ; preds = %bb2
%1 = load { i8*, i32 }, { i8*, i32 }* %personalityslot
resume { i8*, i32 } %1
bb2: ; preds = %cleanup
br label %bb1
bb3: ; preds = %start
br label %bb4
bb4: ; preds = %bb3
ret void
cleanup: ; preds = %start
%2 = landingpad { i8*, i32 }
cleanup
store { i8*, i32 } %2, { i8*, i32 }* %personalityslot
br label %bb2
}
; <i32 as foo::A>::foo2
; Function Attrs: uwtable
define void @"_ZN30_$LT$i32$u20$as$u20$foo..A$GT$4foo217h68eec0bc305998eeE"(i32) unnamed_addr #0 {
start:
; call bar::bar
call void @_ZN3bar3bar17h21868f3a4452d05bE()
br label %bb1
bb1: ; preds = %start
ret void
}
; foo::main
; Function Attrs: uwtable
define internal void @_ZN3foo4main17h5b6dcef98fb6e2cbE() unnamed_addr #0 {
start:
; call foo::A::foo1
call void @_ZN3foo1A4foo117hcfa03453b669bd94E(i32 0)
br label %bb1
bb1: ; preds = %start
; call <i32 as foo::A>::foo2
call void @"_ZN30_$LT$i32$u20$as$u20$foo..A$GT$4foo217h68eec0bc305998eeE"(i32 0)
br label %bb2
bb2: ; preds = %bb1
ret void
}
declare i32 @rust_eh_personality(i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr #1
; bar::bar
declare void @_ZN3bar3bar17h21868f3a4452d05bE() unnamed_addr #1
attributes #0 = { uwtable "probe-stack"="__rust_probestack" }
attributes #1 = { "probe-stack"="__rust_probestack" }
#![crate_type = "rlib"]
extern crate bar;
pub trait A: Sized {
fn foo1(self) {
bar::bar();
}
fn foo2(self);
}
impl A for i32 {
fn foo2(self) {
bar::bar();
}
}
fn main() {
0i32.foo1();
0i32.foo2();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment