Last active
December 24, 2018 08:01
-
-
Save uenoku/11e7b7f93fdda3416f2d3fc20b990995 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
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