Skip to content

Instantly share code, notes, and snippets.

/garm.ll Secret

Created November 3, 2016 15:18
Show Gist options
  • Save anonymous/7609fa5f8604b705a57812a654bf7ebe to your computer and use it in GitHub Desktop.
Save anonymous/7609fa5f8604b705a57812a654bf7ebe to your computer and use it in GitHub Desktop.
; ModuleID = 'garm.cgu-0.rs'
source_filename = "garm.cgu-0.rs"
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "armv7-unknown-linux-gnueabihf"
%str_slice = type { i8*, i32 }
%"2.std::fmt::Arguments" = type { { %str_slice*, i32 }, %"2.std::option::Option<&[std::fmt::rt::v1::Argument]>", { %"2.std::fmt::ArgumentV1"*, i32 } }
%"2.std::option::Option<&[std::fmt::rt::v1::Argument]>" = type { { %"2.std::fmt::rt::v1::Argument"*, i32 } }
%"2.std::fmt::rt::v1::Argument" = type { %"2.std::fmt::rt::v1::Position", %"2.std::fmt::rt::v1::FormatSpec" }
%"2.std::fmt::rt::v1::Position" = type { i32, [0 x i32], [1 x i32] }
%"2.std::fmt::rt::v1::FormatSpec" = type { i32, i8, i32, %"2.std::fmt::rt::v1::Count", %"2.std::fmt::rt::v1::Count" }
%"2.std::fmt::rt::v1::Count" = type { i32, [0 x i32], [1 x i32] }
%"2.std::fmt::ArgumentV1" = type { %"2.core::fmt::Void"*, i8 (%"2.core::fmt::Void"*, %"2.std::fmt::Formatter"*)* }
%"2.core::fmt::Void" = type {}
%"2.std::fmt::Formatter" = type { i32, i32, i8, %"2.std::option::Option<usize>", %"2.std::option::Option<usize>", { i8*, void (i8*)** }, %"2.std::slice::Iter<std::fmt::ArgumentV1>", { %"2.std::fmt::ArgumentV1"*, i32 } }
%"2.std::option::Option<usize>" = type { i32, [0 x i32], [1 x i32] }
%"2.std::slice::Iter<std::fmt::ArgumentV1>" = type { %"2.std::fmt::ArgumentV1"*, %"2.std::fmt::ArgumentV1"*, %"2.std::marker::PhantomData<&std::fmt::ArgumentV1>" }
%"2.std::marker::PhantomData<&std::fmt::ArgumentV1>" = type {}
@str.0 = internal constant [0 x i8] zeroinitializer
@str.1 = internal constant [1 x i8] c"\0A"
@ref.2 = internal unnamed_addr constant [2 x %str_slice] [%str_slice { i8* getelementptr inbounds ([0 x i8], [0 x i8]* @str.0, i32 0, i32 0), i32 0 }, %str_slice { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @str.1, i32 0, i32 0), i32 1 }], align 4
; Function Attrs: uwtable
define internal void @_ZN4garm4main17h77d9d138894e0dc8E() unnamed_addr #0 {
entry-block:
%_2 = alloca %"2.std::fmt::Arguments", align 4
%_7 = alloca [1 x %"2.std::fmt::ArgumentV1"], align 4
%_10 = alloca float, align 4
%0 = bitcast %"2.std::fmt::Arguments"* %_2 to i8*
call void @llvm.lifetime.start(i64 24, i8* %0)
%1 = bitcast [1 x %"2.std::fmt::ArgumentV1"]* %_7 to i8*
call void @llvm.lifetime.start(i64 8, i8* %1)
%2 = bitcast float* %_10 to i8*
call void @llvm.lifetime.start(i64 4, i8* %2)
store float 1.000000e+00, float* %_10, align 4
%3 = ptrtoint float* %_10 to i32
%4 = bitcast [1 x %"2.std::fmt::ArgumentV1"]* %_7 to i32*
store i32 %3, i32* %4, align 4
%5 = getelementptr inbounds [1 x %"2.std::fmt::ArgumentV1"], [1 x %"2.std::fmt::ArgumentV1"]* %_7, i32 0, i32 0, i32 1
%6 = bitcast i8 (%"2.core::fmt::Void"*, %"2.std::fmt::Formatter"*)** %5 to i32*
store i32 ptrtoint (i8 (float*, %"2.std::fmt::Formatter"*)* @"_ZN42_$LT$f32$u20$as$u20$core..fmt..Display$GT$3fmt17ha564466524926d32E" to i32), i32* %6, align 4
%7 = getelementptr inbounds [1 x %"2.std::fmt::ArgumentV1"], [1 x %"2.std::fmt::ArgumentV1"]* %_7, i32 0, i32 0
%8 = getelementptr inbounds %"2.std::fmt::Arguments", %"2.std::fmt::Arguments"* %_2, i32 0, i32 0, i32 0
store %str_slice* getelementptr inbounds ([2 x %str_slice], [2 x %str_slice]* @ref.2, i32 0, i32 0), %str_slice** %8, align 4, !alias.scope !1, !noalias !4
%9 = getelementptr inbounds %"2.std::fmt::Arguments", %"2.std::fmt::Arguments"* %_2, i32 0, i32 0, i32 1
store i32 2, i32* %9, align 4, !alias.scope !1, !noalias !4
%_6.sroa.0.0..sroa_idx.i = getelementptr inbounds %"2.std::fmt::Arguments", %"2.std::fmt::Arguments"* %_2, i32 0, i32 1
%10 = bitcast %"2.std::option::Option<&[std::fmt::rt::v1::Argument]>"* %_6.sroa.0.0..sroa_idx.i to i64*
store i64 0, i64* %10, align 4, !alias.scope !1, !noalias !4
%11 = getelementptr inbounds %"2.std::fmt::Arguments", %"2.std::fmt::Arguments"* %_2, i32 0, i32 2, i32 0
store %"2.std::fmt::ArgumentV1"* %7, %"2.std::fmt::ArgumentV1"** %11, align 4, !alias.scope !1, !noalias !4
%12 = getelementptr inbounds %"2.std::fmt::Arguments", %"2.std::fmt::Arguments"* %_2, i32 0, i32 2, i32 1
store i32 1, i32* %12, align 4, !alias.scope !1, !noalias !4
call void @_ZN3std2io5stdio6_print17h0a3013f9109d374eE(%"2.std::fmt::Arguments"* noalias nocapture nonnull dereferenceable(24) %_2)
call void @llvm.lifetime.end(i64 24, i8* %0)
call void @llvm.lifetime.end(i64 8, i8* %1)
call void @llvm.lifetime.end(i64 4, i8* %2)
ret void
}
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.start(i64, i8* nocapture) #1
; Function Attrs: argmemonly nounwind
declare void @llvm.lifetime.end(i64, i8* nocapture) #1
declare i8 @"_ZN42_$LT$f32$u20$as$u20$core..fmt..Display$GT$3fmt17ha564466524926d32E"(float* noalias readonly dereferenceable(4), %"2.std::fmt::Formatter"* dereferenceable(52)) unnamed_addr
declare void @_ZN3std2io5stdio6_print17h0a3013f9109d374eE(%"2.std::fmt::Arguments"* noalias nocapture dereferenceable(24)) unnamed_addr
define i32 @main(i32, i8**) unnamed_addr {
top:
%2 = tail call i32 @_ZN3std2rt10lang_start17h422db75df2c05551E(i8* bitcast (void ()* @_ZN4garm4main17h77d9d138894e0dc8E to i8*), i32 %0, i8** %1)
ret i32 %2
}
declare i32 @_ZN3std2rt10lang_start17h422db75df2c05551E(i8*, i32, i8**) unnamed_addr
attributes #0 = { uwtable }
attributes #1 = { argmemonly nounwind }
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"PIE Level", i32 2}
!1 = !{!2}
!2 = distinct !{!2, !3, !"_ZN4core3fmt9Arguments6new_v117he714bc425e91af4fE: argument 0"}
!3 = distinct !{!3, !"_ZN4core3fmt9Arguments6new_v117he714bc425e91af4fE"}
!4 = !{!5}
!5 = distinct !{!5, !3, !"_ZN4core3fmt9Arguments6new_v117he714bc425e91af4fE: argument 1"}
#[inline(never)]
fn foo() -> f32 {
12345.0f32.powi(0)
}
fn main() {
println!("{}", foo());
}
.text
.syntax unified
.eabi_attribute 67, "2.09"
.eabi_attribute 6, 10
.eabi_attribute 7, 65
.eabi_attribute 8, 1
.eabi_attribute 9, 2
.fpu vfpv3-d16
.eabi_attribute 15, 1
.eabi_attribute 16, 1
.eabi_attribute 17, 2
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 34, 1
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 28, 1
.eabi_attribute 38, 1
.eabi_attribute 14, 0
.file "garm.cgu-0.rs"
.section .text._ZN4garm4main17h77d9d138894e0dc8E,"ax",%progbits
.p2align 2
.type _ZN4garm4main17h77d9d138894e0dc8E,%function
_ZN4garm4main17h77d9d138894e0dc8E:
.fnstart
.save {r11, lr}
push {r11, lr}
.pad #40
sub sp, sp, #40
mov r0, #1065353216
str r0, [sp, #4]
add r0, sp, #4
str r0, [sp, #8]
ldr r0, .LCPI0_0
.LPC0_1:
ldr r0, [pc, r0]
str r0, [sp, #12]
ldr r0, .LCPI0_1
.LPC0_0:
add r0, pc, r0
str r0, [sp, #16]
mov r0, #2
str r0, [sp, #20]
mov r0, #0
str r0, [sp, #28]
str r0, [sp, #24]
add r0, sp, #8
str r0, [sp, #32]
mov r0, #1
str r0, [sp, #36]
add r0, sp, #16
bl _ZN3std2io5stdio6_print17h0a3013f9109d374eE
add sp, sp, #40
pop {r11, pc}
.p2align 2
.LCPI0_0:
.Ltmp0:
.long _ZN42_$LT$f32$u20$as$u20$core..fmt..Display$GT$3fmt17ha564466524926d32E(GOT_PREL)-((.LPC0_1+8)-.Ltmp0)
.LCPI0_1:
.long ref.2-(.LPC0_0+8)
.Lfunc_end0:
.size _ZN4garm4main17h77d9d138894e0dc8E, .Lfunc_end0-_ZN4garm4main17h77d9d138894e0dc8E
.fnend
.section .text.main,"ax",%progbits
.globl main
.p2align 2
.type main,%function
main:
.fnstart
mov r2, r1
mov r1, r0
ldr r0, .LCPI1_0
.LPC1_0:
add r0, pc, r0
b _ZN3std2rt10lang_start17h422db75df2c05551E
.p2align 2
.LCPI1_0:
.long _ZN4garm4main17h77d9d138894e0dc8E-(.LPC1_0+8)
.Lfunc_end1:
.size main, .Lfunc_end1-main
.fnend
.type str.0,%object
.section .rodata.str.0,"a",%progbits
str.0:
.size str.0, 0
.type str.1,%object
.section .rodata.str.1,"a",%progbits
str.1:
.byte 10
.size str.1, 1
.type ref.2,%object
.section .data.rel.ro.ref.2,"aw",%progbits
.p2align 2
ref.2:
.long str.0
.long 0
.long str.1
.long 1
.size ref.2, 16
.section ".note.GNU-stack","",%progbits
.eabi_attribute 30, 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment