Skip to content

Instantly share code, notes, and snippets.

@Amanieu
Created December 8, 2022 18:12
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 Amanieu/18893e3d5daa22c8fd3893ec90515489 to your computer and use it in GitHub Desktop.
Save Amanieu/18893e3d5daa22c8fd3893ec90515489 to your computer and use it in GitHub Desktop.
; ModuleID = 'test.a298ebb3-cgu.0'
source_filename = "test.a298ebb3-cgu.0"
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"
target triple = "wasm32-unknown-wasi"
@vtable.0 = private unnamed_addr constant <{ ptr, [8 x i8], ptr, ptr, ptr }> <{ ptr @"_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h166e0057eb7dac29E", [8 x i8] c"\04\00\00\00\04\00\00\00", ptr @"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h1a558d8d80021a86E", ptr @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h76b0bf6ab1e8be97E", ptr @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h76b0bf6ab1e8be97E" }>, align 4
; std::sys_common::backtrace::__rust_begin_short_backtrace
; Function Attrs: noinline nounwind
define internal fastcc void @_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hcf2d11bbcd93b116E(ptr nocapture noundef nonnull readonly %f) unnamed_addr #0 {
start:
tail call void %f() #6
tail call void asm sideeffect "", "~{memory}"() #6, !srcloc !0
ret void
}
; std::rt::lang_start
; Function Attrs: nounwind
define hidden i32 @_ZN3std2rt10lang_start17h11db8ee4dd1b8659E(ptr noundef nonnull %main, i32 %argc, ptr %argv, i8 %sigpipe) unnamed_addr #1 {
start:
%_9 = alloca ptr, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %_9)
store ptr %main, ptr %_9, align 4
; call std::rt::lang_start_internal
%0 = call i32 @_ZN3std2rt19lang_start_internal17hdd3e2d4bd7ae06a7E(ptr noundef nonnull align 1 %_9, ptr noalias noundef nonnull readonly align 4 dereferenceable(12) @vtable.0, i32 %argc, ptr %argv, i8 %sigpipe) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %_9)
ret i32 %0
}
; std::rt::lang_start::{{closure}}
; Function Attrs: inlinehint nounwind
define internal i32 @"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h76b0bf6ab1e8be97E"(ptr noalias nocapture noundef readonly align 4 dereferenceable(4) %_1) unnamed_addr #2 {
start:
%self = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %self)
%_4 = load ptr, ptr %_1, align 4, !nonnull !1, !noundef !1
; call std::sys_common::backtrace::__rust_begin_short_backtrace
tail call fastcc void @_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hcf2d11bbcd93b116E(ptr noundef nonnull %_4) #6
store i8 0, ptr %self, align 1
; call std::sys::wasi::process::ExitCode::as_i32
%0 = call i32 @_ZN3std3sys4wasi7process8ExitCode6as_i3217hb0f173c63ab463acE(ptr noalias noundef nonnull readonly align 1 dereferenceable(1) %self) #6
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %self)
ret i32 %0
}
; core::ops::function::FnOnce::call_once{{vtable.shim}}
; Function Attrs: inlinehint nounwind
define internal i32 @"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h1a558d8d80021a86E"(ptr nocapture readonly %_1) unnamed_addr #2 {
start:
%self.i.i = alloca i8, align 1
%0 = load ptr, ptr %_1, align 4, !nonnull !1, !noundef !1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %self.i.i), !noalias !2
; call std::sys_common::backtrace::__rust_begin_short_backtrace
tail call fastcc void @_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hcf2d11bbcd93b116E(ptr noundef nonnull %0) #6, !noalias !2
store i8 0, ptr %self.i.i, align 1, !noalias !2
; call std::sys::wasi::process::ExitCode::as_i32
%1 = call i32 @_ZN3std3sys4wasi7process8ExitCode6as_i3217hb0f173c63ab463acE(ptr noalias noundef nonnull readonly align 1 dereferenceable(1) %self.i.i) #6, !noalias !2
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %self.i.i), !noalias !2
ret i32 %1
}
; core::ptr::drop_in_place<std::rt::lang_start<()>::{{closure}}>
; Function Attrs: inlinehint mustprogress nofree norecurse nosync nounwind readnone willreturn
define internal void @"_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17h166e0057eb7dac29E"(ptr nocapture %_1) unnamed_addr #3 {
start:
ret void
}
; test::main
; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
define internal void @_ZN4test4main17h446370c83cc3b835E() unnamed_addr #4 {
start:
ret void
}
; std::rt::lang_start_internal
; Function Attrs: nounwind
declare dso_local i32 @_ZN3std2rt19lang_start_internal17hdd3e2d4bd7ae06a7E(ptr noundef nonnull align 1, ptr noalias noundef readonly align 4 dereferenceable(12), i32, ptr, i8) unnamed_addr #1
; std::sys::wasi::process::ExitCode::as_i32
; Function Attrs: nounwind
declare dso_local i32 @_ZN3std3sys4wasi7process8ExitCode6as_i3217hb0f173c63ab463acE(ptr noalias noundef readonly align 1 dereferenceable(1)) unnamed_addr #1
; Function Attrs: nounwind
define hidden i32 @main() unnamed_addr #1 {
top:
%_9.i = alloca ptr, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %_9.i)
store ptr @_ZN4test4main17h446370c83cc3b835E, ptr %_9.i, align 4
; call std::rt::lang_start_internal
%0 = call i32 @_ZN3std2rt19lang_start_internal17hdd3e2d4bd7ae06a7E(ptr noundef nonnull align 1 %_9.i, ptr noalias noundef nonnull readonly align 4 dereferenceable(12) @vtable.0, i32 0, ptr null, i8 0) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %_9.i)
ret i32 %0
}
; Function Attrs: argmemonly mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: argmemonly mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
attributes #0 = { noinline nounwind "target-cpu"="generic" }
attributes #1 = { nounwind "target-cpu"="generic" }
attributes #2 = { inlinehint nounwind "target-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nofree norecurse nosync nounwind readnone willreturn "target-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind readnone willreturn "target-cpu"="generic" }
attributes #5 = { argmemonly mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { nounwind }
!0 = !{i32 1199287}
!1 = !{}
!2 = !{!3}
!3 = distinct !{!3, !4, !"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h76b0bf6ab1e8be97E: %_1"}
!4 = distinct !{!4, !"_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h76b0bf6ab1e8be97E"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment