Skip to content

Instantly share code, notes, and snippets.

@huonw
Last active January 3, 2016 16:49
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 huonw/b7571a7b5998bfc7b9ac to your computer and use it in GitHub Desktop.
Save huonw/b7571a7b5998bfc7b9ac to your computer and use it in GitHub Desktop.
#[crate_type="lib"];
pub struct Foo {
x: uint,
y: uint
}
#[inline(never)]
#[no_mangle]
pub fn foo(f: Foo) -> Foo {
f
}
#[no_mangle]
pub fn bar(f: Foo) -> Foo {
foo(f)
}
; Function Attrs: noinline nounwind uwtable
define void @foo(%struct.Foo* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone, %struct.Foo* nocapture readonly) unnamed_addr #1 {
"function top level":
%3 = bitcast %struct.Foo* %2 to i8*
%4 = bitcast %struct.Foo* %0 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %3, i64 16, i32 8, i1 false)
ret void
}
; Function Attrs: nounwind uwtable
define void @bar(%struct.Foo* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone, %struct.Foo* nocapture readonly) unnamed_addr #2 {
"function top level":
%__self = alloca %struct.Foo, align 8
%3 = bitcast %struct.Foo* %2 to i8*
%4 = bitcast %struct.Foo* %__self to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %3, i64 16, i32 8, i1 false)
call void @foo(%struct.Foo* sret %0, { i64, %tydesc*, i8*, i8*, i8 }* undef, %struct.Foo* %__self)
ret void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment