Skip to content

Instantly share code, notes, and snippets.

@luqmana
Last active December 30, 2015 08:09
Show Gist options
  • Save luqmana/d372a04ef1a2af7fc370 to your computer and use it in GitHub Desktop.
Save luqmana/d372a04ef1a2af7fc370 to your computer and use it in GitHub Desktop.
; Function Attrs: uwtable
define internal void @_ZN4main19h69285bc34c708271at4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }*) unnamed_addr #4 {
"function top level":
%_a = alloca %struct.Thing
%1 = alloca [0 x i64*]
%__adjust = alloca { i64**, i64 }
%2 = alloca { i8*, i32 }
%3 = getelementptr inbounds %struct.Thing* %_a, i32 0, i32 0
%4 = getelementptr inbounds [0 x i64*]* %1, i32 0, i32 0
%5 = getelementptr inbounds [0 x i64*]* %1, i32 0, i32 0
%6 = getelementptr inbounds { i64**, i64 }* %__adjust, i32 0, i32 0
store i64** %5, i64*** %6
%7 = getelementptr inbounds { i64**, i64 }* %__adjust, i32 0, i32 1
store i64 0, i64* %7
%8 = bitcast { i64**, i64 }* %__adjust to i8*
%9 = bitcast { i64**, i64 }* %3 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %9, i8* %8, i64 16, i32 8, i1 false)
%10 = getelementptr inbounds %struct.Thing* %_a, i32 0, i32 1
%11 = invoke i8* @_ZN2rt11global_heap15exchange_malloc19h61212acde683c476aF4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
to label %"normal return" unwind label %unwind
"normal return": ; preds = %"function top level"
%12 = bitcast i8* %11 to i64*
store i64 32, i64* %12
store i64* %12, i64** %10
call void @"_ZN13Thing$LT$$GT$9glue_drop19hb4d5764a91a55499ahE"({}* null, %struct.Thing* %_a)
call void @"_ZN30_$x5b$UP$int$C$$x20..$x200$x5d9glue_drop18hce0e9422dafef8aa3E"({}* null, [0 x i64*]* %1)
ret void
unwind: ; preds = %"function top level"
%13 = landingpad { i8*, i32 } personality i32 ()* @upcall_rust_personality
cleanup
call void @upcall_reset_stack_limit()
store { i8*, i32 } %13, { i8*, i32 }* %2
br label %cleanup
cleanup: ; preds = %unwind
call void @"_ZN30_$x5b$UP$int$C$$x20..$x200$x5d9glue_drop18hce0e9422dafef8aa3E"({}* null, { i64**, i64 }* %3)
call void @"_ZN30_$x5b$UP$int$C$$x20..$x200$x5d9glue_drop18hce0e9422dafef8aa3E"({}* null, [0 x i64*]* %1)
%14 = load { i8*, i32 }* %2
resume { i8*, i32 } %14
}
struct Thing<'self> {
baz: &'self [~int],
bar: ~u64,
}
fn main() {
let _a = Thing {
baz: [],
bar: ~32
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment