Skip to content

Instantly share code, notes, and snippets.

@Voultapher
Created July 8, 2018 20:48
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 Voultapher/7e906ab8076dd6fafa9a80a2780ed4fb to your computer and use it in GitHub Desktop.
Save Voultapher/7e906ab8076dd6fafa9a80a2780ed4fb to your computer and use it in GitHub Desktop.
rustc --crate-type=lib -O main.rs --emit=llvm-ir
; ModuleID = 'main0-8787f43e282added376259c1adb08b80.rs'
source_filename = "main0-8787f43e282added376259c1adb08b80.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 { [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] }
; main::return_option
; Function Attrs: norecurse nounwind readnone uwtable
define { i64, i64 } @_ZN4main13return_option17h753bafe80c73e49fE(i64 %x) unnamed_addr #0 {
start:
%0 = icmp slt i64 %x, 32
%1 = srem i64 %x, 752
%_0.sroa.0.0 = zext i1 %0 to i64
%2 = insertvalue { i64, i64 } undef, i64 %_0.sroa.0.0, 0
%3 = insertvalue { i64, i64 } %2, i64 %1, 1
ret { i64, i64 } %3
}
; main::foo
; Function Attrs: norecurse nounwind readnone uwtable
define i64 @_ZN4main3foo17h4446f8db1af5d6d1E(i64 %x) unnamed_addr #0 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
start:
%0 = icmp sgt i64 %x, 31
%1 = srem i64 %x, 752
%..i = select i1 %0, i64 17, i64 %1
%2 = add i64 %..i, %x
ret i64 %2
}
declare i32 @rust_eh_personality(i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*) unnamed_addr #1
attributes #0 = { norecurse nounwind readnone uwtable "probe-stack"="__rust_probestack" }
attributes #1 = { "probe-stack"="__rust_probestack" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment