Skip to content

Instantly share code, notes, and snippets.

@uenoku
Last active Dec 24, 2018
Embed
What would you like to do?
"
let rec fib n = if n <= 1 then n else
fib(n-1) + fib(n-2) in fib(3)
"
.text
.file "fib.ml.ll"
.globl V19.V9.fib # -- Begin function V19.V9.fib
.p2align 2
.type V19.V9.fib,@function
V19.V9.fib: # @V19.V9.fib
# %bb.0: # %entry
store %sp, %sp, -4
addi %sp, %sp, -4
store %lr, %sp, 3 # 4-byte Folded Spill
cmpdi %r3,2
blt .LBB0_2
jump .LBB0_1
.LBB0_1: # %else
store %r3, %sp, 1 # 4-byte Folded Spill
addi %r3, %r3, -1
bl V19.V9.fib
store %r3, %sp, 2 # 4-byte Folded Spill
load %r3, %sp, 1 # 4-byte Folded Reload
addi %r3, %r3, -2
bl V19.V9.fib
load %r4, %sp, 2 # 4-byte Folded Reload
add %r3, %r3, %r4
.LBB0_2: # %ifcont
load %lr, %sp, 3 # 4-byte Folded Reload
load %sp, %sp, 0
blr
.Lfunc_end0:
.size V19.V9.fib, .Lfunc_end0-V19.V9.fib
# -- End function
.globl main # -- Begin function main
.p2align 2
.type main,@function
main: # @main
# %bb.0: # %entry
li %r3, 2
store %r3, %r0, 1
blr
.Lfunc_end1:
.size main, .Lfunc_end1-main
# -- End function
.section ".note.GNU-stack","",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment