aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2021-01-07 18:58:20 +0100
committerCamil Staps2021-01-07 18:58:20 +0100
commit7648792e62a349dd6c05a5f97658e1ae3be090f6 (patch)
tree8afe81af6a69ba04ee8db205b01823e070a387ab
parentCentralize instruction implementations (diff)
Replace tabs by two spaces
-rw-r--r--fib_eqI_b.ll200
-rw-r--r--fib_ltI.ll100
-rw-r--r--nfib.ll112
-rw-r--r--rts.ll244
4 files changed, 328 insertions, 328 deletions
diff --git a/fib_eqI_b.ll b/fib_eqI_b.ll
index 73a9b81..ac9cbca 100644
--- a/fib_eqI_b.ll
+++ b/fib_eqI_b.ll
@@ -1,145 +1,145 @@
define i64* @e_fib_eqI_b_nfib(i64* %n, i64** %globasp) prefix {i8*, i64} {i8* inttoptr (i64 0 to i8*), i64 1} {
- %astack = alloca i64*, i64 10
- %asp.000 = getelementptr i64*, i64** %astack
- %bstack = alloca i64, i64 10
- %bsp.000 = getelementptr i64, i64* %bstack, i64 9
+ %astack = alloca i64*, i64 10
+ %asp.000 = getelementptr i64*, i64** %astack
+ %bstack = alloca i64, i64 10
+ %bsp.000 = getelementptr i64, i64* %bstack, i64 9
- %asp.001 = getelementptr i64*, i64** %asp.000, i64 1
- store i64* %n, i64** %asp.001
+ %asp.001 = getelementptr i64*, i64** %asp.000, i64 1
+ store i64* %n, i64** %asp.001
- %t.0 = bitcast i64*(i64**)* @_cycle_in_spine to i64*
- %asp.002 = call i64** @push_node(i64* %t.0, i64 1, i64** %asp.001)
+ %t.0 = bitcast i64*(i64**)* @_cycle_in_spine to i64*
+ %asp.002 = call i64** @push_node(i64* %t.0, i64 1, i64** %asp.001)
- %t.1 = call i64* @peek_a(i64** %asp.002)
- %asp.003 = call i64** @pop_a1(i64** %asp.002)
- %globasp.0 = call i64** @_push_local_astack(i64** %asp.003, i64** %asp.000, i64** %globasp)
- %t.2 = call i64 @ea1(i64* %t.1, i64** %globasp.0)
- %bsp.001 = call i64* @pushI(i64 %t.2, i64* %bsp.000)
+ %t.1 = call i64* @peek_a(i64** %asp.002)
+ %asp.003 = call i64** @pop_a1(i64** %asp.002)
+ %globasp.0 = call i64** @_push_local_astack(i64** %asp.003, i64** %asp.000, i64** %globasp)
+ %t.2 = call i64 @ea1(i64* %t.1, i64** %globasp.0)
+ %bsp.001 = call i64* @pushI(i64 %t.2, i64* %bsp.000)
- %asp.004 = call i64** @fillI_b(i64 0, i64 -0, i64* %bsp.001, i64** %asp.003)
- %bsp.002 = call i64* @pop_b1(i64* %bsp.001)
+ %asp.004 = call i64** @fillI_b(i64 0, i64 -0, i64* %bsp.001, i64** %asp.003)
+ %bsp.002 = call i64* @pop_b1(i64* %bsp.001)
- %t.3 = call i64* @peek_a(i64** %asp.004)
- %asp.005 = call i64** @pop_a1(i64** %asp.004)
- ret i64* %t.3
+ %t.3 = call i64* @peek_a(i64** %asp.004)
+ %asp.005 = call i64** @pop_a1(i64** %asp.004)
+ ret i64* %t.3
}
define private i64 @ea1(i64* %n, i64** %globasp) {
- %astack = alloca i64*, i64 10
- %asp.000 = getelementptr i64*, i64** %astack, i64 0
- %bstack = alloca i64, i64 10
- %bsp.000 = getelementptr i64, i64* %bstack, i64 9
-
- %asp.001 = getelementptr i64*, i64** %asp.000, i64 1
- store i64* %n, i64** %asp.001
-
- %asp.002 = call i64** @jsr_eval(i64 -0, i64** %asp.001, i64** %asp.000, i64** %globasp)
- %bsp.001 = call i64* @pushI_a(i64 -0, i64* %bsp.000, i64** %asp.002)
- %asp.003 = call i64** @pop_a1(i64** %asp.002)
-
- %t.0 = call i64 @peek_b(i64* %bsp.001)
- %bsp.002 = call i64* @pop_b1(i64* %bsp.001)
- %t.1 = tail call i64 @s1(i64 %t.0, i64** %globasp)
- ret i64 %t.1
+ %astack = alloca i64*, i64 10
+ %asp.000 = getelementptr i64*, i64** %astack, i64 0
+ %bstack = alloca i64, i64 10
+ %bsp.000 = getelementptr i64, i64* %bstack, i64 9
+
+ %asp.001 = getelementptr i64*, i64** %asp.000, i64 1
+ store i64* %n, i64** %asp.001
+
+ %asp.002 = call i64** @jsr_eval(i64 -0, i64** %asp.001, i64** %asp.000, i64** %globasp)
+ %bsp.001 = call i64* @pushI_a(i64 -0, i64* %bsp.000, i64** %asp.002)
+ %asp.003 = call i64** @pop_a1(i64** %asp.002)
+
+ %t.0 = call i64 @peek_b(i64* %bsp.001)
+ %bsp.002 = call i64* @pop_b1(i64* %bsp.001)
+ %t.1 = tail call i64 @s1(i64 %t.0, i64** %globasp)
+ ret i64 %t.1
}
define i64 @e_fib_eqI_b_sfib(i64 %arg, i64** %globasp) #0 {
- %r = tail call i64 @s1(i64 %arg, i64** %globasp)
- ret i64 %r
+ %r = tail call i64 @s1(i64 %arg, i64** %globasp)
+ ret i64 %r
}
define private i64 @s1(i64 %arg, i64** %globasp) #0 {
- %astack = alloca i64*, i64 10000
- %asp.000 = getelementptr i64*, i64** %astack
- %bstack = alloca i64, i64 10000
- %bsp.000 = getelementptr i64, i64* %bstack, i64 9999
+ %astack = alloca i64*, i64 10000
+ %asp.000 = getelementptr i64*, i64** %astack
+ %bstack = alloca i64, i64 10000
+ %bsp.000 = getelementptr i64, i64* %bstack, i64 9999
- %bsp.001 = call i64* @pushI(i64 %arg, i64* %bsp.000)
+ %bsp.001 = call i64* @pushI(i64 %arg, i64* %bsp.000)
- %bsp.002 = call i64* @eqI_b(i64 0, i64 0, i64* %bsp.001)
- %t.0 = call i64 @peek_b(i64* %bsp.002)
- %bsp.003 = call i64* @pop_b1(i64* %bsp.002)
- %t.1 = trunc i64 %t.0 to i1
- br i1 %t.1, label %case.1, label %l.0
+ %bsp.002 = call i64* @eqI_b(i64 0, i64 0, i64* %bsp.001)
+ %t.0 = call i64 @peek_b(i64* %bsp.002)
+ %bsp.003 = call i64* @pop_b1(i64* %bsp.002)
+ %t.1 = trunc i64 %t.0 to i1
+ br i1 %t.1, label %case.1, label %l.0
l.0:
- %bsp.004 = call i64* @eqI_b(i64 1, i64 0, i64* %bsp.003)
- %t.2 = call i64 @peek_b(i64* %bsp.004)
- %bsp.005 = call i64* @pop_b1(i64* %bsp.004)
- %t.3 = trunc i64 %t.2 to i1
- br i1 %t.3, label %case.2, label %case.3
+ %bsp.004 = call i64* @eqI_b(i64 1, i64 0, i64* %bsp.003)
+ %t.2 = call i64 @peek_b(i64* %bsp.004)
+ %bsp.005 = call i64* @pop_b1(i64* %bsp.004)
+ %t.3 = trunc i64 %t.2 to i1
+ br i1 %t.3, label %case.2, label %case.3
case.1:
- %bsp.100 = call i64* @pop_b1(i64* %bsp.003)
- %bsp.101 = call i64* @pushI(i64 1, i64* %bsp.100)
+ %bsp.100 = call i64* @pop_b1(i64* %bsp.003)
+ %bsp.101 = call i64* @pushI(i64 1, i64* %bsp.100)
- %r.1 = call i64 @peek_b(i64* %bsp.101)
- %bsp.102 = call i64* @pop_b1(i64* %bsp.101)
+ %r.1 = call i64 @peek_b(i64* %bsp.101)
+ %bsp.102 = call i64* @pop_b1(i64* %bsp.101)
- ret i64 %r.1
+ ret i64 %r.1
case.2:
- %bsp.200 = call i64* @pop_b1(i64* %bsp.005)
- %bsp.201 = call i64* @pushI(i64 1, i64* %bsp.200)
+ %bsp.200 = call i64* @pop_b1(i64* %bsp.005)
+ %bsp.201 = call i64* @pushI(i64 1, i64* %bsp.200)
- %r.2 = call i64 @peek_b(i64* %bsp.201)
- %bsp.202 = call i64* @pop_b1(i64* %bsp.201)
+ %r.2 = call i64 @peek_b(i64* %bsp.201)
+ %bsp.202 = call i64* @pop_b1(i64* %bsp.201)
- ret i64 %r.2
+ ret i64 %r.2
case.3:
- %bsp.300 = call i64* @pushI(i64 1, i64* %bsp.005)
- %bsp.301 = call i64* @push_b(i64 1, i64* %bsp.300)
- %bsp.302 = call i64* @subI(i64* %bsp.301)
+ %bsp.300 = call i64* @pushI(i64 1, i64* %bsp.005)
+ %bsp.301 = call i64* @push_b(i64 1, i64* %bsp.300)
+ %bsp.302 = call i64* @subI(i64* %bsp.301)
- %arg.0 = call i64 @peek_b(i64* %bsp.302)
- %bsp.302.0 = call i64* @pop_b1(i64* %bsp.302)
- %ret.0 = call i64 @s1(i64 %arg.0, i64** %globasp)
- %bsp.303 = call i64* @pushI(i64 %ret.0, i64* %bsp.302.0)
+ %arg.0 = call i64 @peek_b(i64* %bsp.302)
+ %bsp.302.0 = call i64* @pop_b1(i64* %bsp.302)
+ %ret.0 = call i64 @s1(i64 %arg.0, i64** %globasp)
+ %bsp.303 = call i64* @pushI(i64 %ret.0, i64* %bsp.302.0)
- %bsp.304 = call i64* @pushI(i64 2, i64* %bsp.303)
- %bsp.305 = call i64* @push_b(i64 2, i64* %bsp.304)
- %bsp.306 = call i64* @subI(i64* %bsp.305)
+ %bsp.304 = call i64* @pushI(i64 2, i64* %bsp.303)
+ %bsp.305 = call i64* @push_b(i64 2, i64* %bsp.304)
+ %bsp.306 = call i64* @subI(i64* %bsp.305)
- %arg.1 = call i64 @peek_b(i64* %bsp.306)
- %bsp.306.0 = call i64* @pop_b1(i64* %bsp.306)
- %ret.1 = call i64 @s1(i64 %arg.1, i64** %globasp)
- %bsp.307 = call i64* @pushI(i64 %ret.1, i64* %bsp.306.0)
+ %arg.1 = call i64 @peek_b(i64* %bsp.306)
+ %bsp.306.0 = call i64* @pop_b1(i64* %bsp.306)
+ %ret.1 = call i64 @s1(i64 %arg.1, i64** %globasp)
+ %bsp.307 = call i64* @pushI(i64 %ret.1, i64* %bsp.306.0)
- %bsp.308 = call i64* @update_b(i64 1, i64 2, i64* %bsp.307)
- %bsp.309 = call i64* @updatepop_b01(i64* %bsp.308)
- %bsp.310 = call i64* @addI(i64* %bsp.309)
+ %bsp.308 = call i64* @update_b(i64 1, i64 2, i64* %bsp.307)
+ %bsp.309 = call i64* @updatepop_b01(i64* %bsp.308)
+ %bsp.310 = call i64* @addI(i64* %bsp.309)
- %r.3 = call i64 @peek_b(i64* %bsp.310)
- %bsp.311 = call i64* @pop_b1(i64* %bsp.310)
+ %r.3 = call i64 @peek_b(i64* %bsp.310)
+ %bsp.311 = call i64* @pop_b1(i64* %bsp.310)
- ret i64 %r.3
+ ret i64 %r.3
}
define i64 @main() {
- %heap = bitcast [10000 x i64]* @heap to i64*
- %astack = bitcast [10000 x i64*]* @astack to i64**
+ %heap = bitcast [10000 x i64]* @heap to i64*
+ %astack = bitcast [10000 x i64*]* @astack to i64**
- %n.0 = getelementptr i64, i64* %heap
- %INT.0 = ptrtoint {i64, i64, i64*, i64, i8, i8, i8}* @INT to i64
- %INT.1 = add i64 %INT.0, 2
- store i64 %INT.1, i64* %n.0
- %n.0.0 = getelementptr i64, i64* %n.0, i64 1
- store i64 43, i64* %n.0.0
+ %n.0 = getelementptr i64, i64* %heap
+ %INT.0 = ptrtoint {i64, i64, i64*, i64, i8, i8, i8}* @INT to i64
+ %INT.1 = add i64 %INT.0, 2
+ store i64 %INT.1, i64* %n.0
+ %n.0.0 = getelementptr i64, i64* %n.0, i64 1
+ store i64 43, i64* %n.0.0
- %n.1 = getelementptr i64, i64* %n.0, i64 2
- store i64 ptrtoint (i64*(i64*,i64**)* @e_fib_eqI_b_nfib to i64), i64* %n.1
- %t.0 = ptrtoint i64* %n.0 to i64
- %n.1.0 = getelementptr i64, i64* %n.1, i64 1
- store i64 %t.0, i64* %n.1.0
+ %n.1 = getelementptr i64, i64* %n.0, i64 2
+ store i64 ptrtoint (i64*(i64*,i64**)* @e_fib_eqI_b_nfib to i64), i64* %n.1
+ %t.0 = ptrtoint i64* %n.0 to i64
+ %n.1.0 = getelementptr i64, i64* %n.1, i64 1
+ store i64 %t.0, i64* %n.1.0
- %n.2 = call i64* @e_fib_eqI_b_nfib(i64* %n.1, i64** %astack)
- %n.3 = getelementptr i64, i64* %n.2, i64 1
+ %n.2 = call i64* @e_fib_eqI_b_nfib(i64* %n.1, i64** %astack)
+ %n.3 = getelementptr i64, i64* %n.2, i64 1
- %r = load i64, i64* %n.3
+ %r = load i64, i64* %n.3
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %r)
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_c, i64 0, i64 0), i64 10)
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %r)
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_c, i64 0, i64 0), i64 10)
- ret i64 0
+ ret i64 0
}
diff --git a/fib_ltI.ll b/fib_ltI.ll
index 65598fd..b8e5fbf 100644
--- a/fib_ltI.ll
+++ b/fib_ltI.ll
@@ -1,69 +1,69 @@
define private i64 @s1(i64 %arg, i64** %globasp) {
- %astack = alloca i64*, i64 10000
- %asp.000 = getelementptr i64*, i64** %astack
- %bstack = alloca i64, i64 10000
- %bsp.000 = getelementptr i64, i64* %bstack, i64 9999
+ %astack = alloca i64*, i64 10000
+ %asp.000 = getelementptr i64*, i64** %astack
+ %bstack = alloca i64, i64 10000
+ %bsp.000 = getelementptr i64, i64* %bstack, i64 9999
- %bsp.001 = call i64* @pushI(i64 %arg, i64* %bsp.000)
+ %bsp.001 = call i64* @pushI(i64 %arg, i64* %bsp.000)
- %bsp.100 = call i64* @pushI(i64 2, i64* %bsp.001)
- %bsp.101 = call i64* @push_b(i64 1, i64* %bsp.100)
- %bsp.102 = call i64* @ltI(i64* %bsp.101)
+ %bsp.100 = call i64* @pushI(i64 2, i64* %bsp.001)
+ %bsp.101 = call i64* @push_b(i64 1, i64* %bsp.100)
+ %bsp.102 = call i64* @ltI(i64* %bsp.101)
- %t.0 = call i64 @peek_b(i64* %bsp.102)
- %bsp.103 = call i64* @pop_b1(i64* %bsp.102)
- %t.1 = trunc i64 %t.0 to i1
- br i1 %t.1, label %l.0, label %else.1
+ %t.0 = call i64 @peek_b(i64* %bsp.102)
+ %bsp.103 = call i64* @pop_b1(i64* %bsp.102)
+ %t.1 = trunc i64 %t.0 to i1
+ br i1 %t.1, label %l.0, label %else.1
l.0:
- %bsp.200 = call i64* @pop_b1(i64* %bsp.103)
- %bsp.201 = call i64* @pushI(i64 1, i64* %bsp.200)
+ %bsp.200 = call i64* @pop_b1(i64* %bsp.103)
+ %bsp.201 = call i64* @pushI(i64 1, i64* %bsp.200)
- %r = call i64 @peek_b(i64* %bsp.201)
- %bsp.202 = call i64* @pop_b1(i64* %bsp.201)
- ret i64 %r
+ %r = call i64 @peek_b(i64* %bsp.201)
+ %bsp.202 = call i64* @pop_b1(i64* %bsp.201)
+ ret i64 %r
else.1:
- %bsp.300 = call i64* @pushI(i64 1, i64* %bsp.103)
- %bsp.301 = call i64* @push_b(i64 1, i64* %bsp.300)
- %bsp.302 = call i64* @subI(i64* %bsp.301)
-
- %arg.0 = call i64 @peek_b(i64* %bsp.302)
- %bsp.302.0 = call i64* @pop_b1(i64* %bsp.302)
- %r.0 = call i64 @s1(i64 %arg.0, i64** %globasp)
- %bsp.303 = call i64* @pushI(i64 %r.0, i64* %bsp.302.0)
-
- %bsp.304 = call i64* @pushI(i64 2, i64* %bsp.303)
- %bsp.305 = call i64* @push_b(i64 2, i64* %bsp.304)
- %bsp.306 = call i64* @subI(i64* %bsp.305)
-
- %arg.1 = call i64 @peek_b(i64* %bsp.306)
- %bsp.306.0 = call i64* @pop_b1(i64* %bsp.306)
- %r.1 = call i64 @s1(i64 %arg.1, i64** %globasp)
- %bsp.307 = call i64* @pushI(i64 %r.1, i64* %bsp.306.0)
-
- %bsp.308 = call i64* @update_b(i64 1, i64 2, i64* %bsp.307)
- %bsp.309 = call i64* @updatepop_b01(i64* %bsp.308)
- %bsp.310 = call i64* @addI(i64* %bsp.309)
-
- %relse = call i64 @peek_b(i64* %bsp.310)
- %bsp.311 = call i64* @pop_b1(i64* %bsp.310)
- ret i64 %relse
+ %bsp.300 = call i64* @pushI(i64 1, i64* %bsp.103)
+ %bsp.301 = call i64* @push_b(i64 1, i64* %bsp.300)
+ %bsp.302 = call i64* @subI(i64* %bsp.301)
+
+ %arg.0 = call i64 @peek_b(i64* %bsp.302)
+ %bsp.302.0 = call i64* @pop_b1(i64* %bsp.302)
+ %r.0 = call i64 @s1(i64 %arg.0, i64** %globasp)
+ %bsp.303 = call i64* @pushI(i64 %r.0, i64* %bsp.302.0)
+
+ %bsp.304 = call i64* @pushI(i64 2, i64* %bsp.303)
+ %bsp.305 = call i64* @push_b(i64 2, i64* %bsp.304)
+ %bsp.306 = call i64* @subI(i64* %bsp.305)
+
+ %arg.1 = call i64 @peek_b(i64* %bsp.306)
+ %bsp.306.0 = call i64* @pop_b1(i64* %bsp.306)
+ %r.1 = call i64 @s1(i64 %arg.1, i64** %globasp)
+ %bsp.307 = call i64* @pushI(i64 %r.1, i64* %bsp.306.0)
+
+ %bsp.308 = call i64* @update_b(i64 1, i64 2, i64* %bsp.307)
+ %bsp.309 = call i64* @updatepop_b01(i64* %bsp.308)
+ %bsp.310 = call i64* @addI(i64* %bsp.309)
+
+ %relse = call i64 @peek_b(i64* %bsp.310)
+ %bsp.311 = call i64* @pop_b1(i64* %bsp.310)
+ ret i64 %relse
}
define private i64 @_s2(i64 %arg, i64** %globasp) {
- %ret = tail call i64 @s1(i64 %arg, i64** %globasp)
- ret i64 %ret
+ %ret = tail call i64 @s1(i64 %arg, i64** %globasp)
+ ret i64 %ret
}
define i64 @main() {
- %heap = bitcast [10000 x i64]* @heap to i64*
- %astack = bitcast [10000 x i64*]* @astack to i64**
+ %heap = bitcast [10000 x i64]* @heap to i64*
+ %astack = bitcast [10000 x i64*]* @astack to i64**
- %r = call i64 @_s2(i64 43, i64** %astack)
+ %r = call i64 @_s2(i64 43, i64** %astack)
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %r)
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_c, i64 0, i64 0), i64 10)
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %r)
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_c, i64 0, i64 0), i64 10)
- ret i64 0
+ ret i64 0
}
diff --git a/nfib.ll b/nfib.ll
index c2cba08..967ca19 100644
--- a/nfib.ll
+++ b/nfib.ll
@@ -1,75 +1,75 @@
define private i64 @s1(i64 %arg, i64** %globasp) #0 {
- %astack = alloca i64*, i64 10000
- %asp.000 = getelementptr i64*, i64** %astack
- %bstack = alloca i64, i64 10000
- %bsp.000 = getelementptr i64, i64* %bstack, i64 9999
+ %astack = alloca i64*, i64 10000
+ %asp.000 = getelementptr i64*, i64** %astack
+ %bstack = alloca i64, i64 10000
+ %bsp.000 = getelementptr i64, i64* %bstack, i64 9999
- %bsp.001 = call i64* @pushI(i64 %arg, i64* %bsp.000)
+ %bsp.001 = call i64* @pushI(i64 %arg, i64* %bsp.000)
- %bsp.100 = call i64* @pushI(i64 2, i64* %bsp.001)
- %bsp.101 = call i64* @push_b(i64 1, i64* %bsp.100)
- %bsp.102 = call i64* @ltI(i64* %bsp.101)
+ %bsp.100 = call i64* @pushI(i64 2, i64* %bsp.001)
+ %bsp.101 = call i64* @push_b(i64 1, i64* %bsp.100)
+ %bsp.102 = call i64* @ltI(i64* %bsp.101)
- %t.0 = call i64 @peek_b(i64* %bsp.102)
- %bsp.103 = call i64* @pop_b1(i64* %bsp.102)
- %t.1 = trunc i64 %t.0 to i1
- br i1 %t.1, label %l.0, label %else.1
+ %t.0 = call i64 @peek_b(i64* %bsp.102)
+ %bsp.103 = call i64* @pop_b1(i64* %bsp.102)
+ %t.1 = trunc i64 %t.0 to i1
+ br i1 %t.1, label %l.0, label %else.1
l.0:
- %bsp.200 = call i64* @pop_b1(i64* %bsp.103)
- %bsp.201 = call i64* @pushI(i64 1, i64* %bsp.200)
+ %bsp.200 = call i64* @pop_b1(i64* %bsp.103)
+ %bsp.201 = call i64* @pushI(i64 1, i64* %bsp.200)
- %r = call i64 @peek_b(i64* %bsp.201)
- %bsp.202 = call i64* @pop_b1(i64* %bsp.201)
- ret i64 %r
+ %r = call i64 @peek_b(i64* %bsp.201)
+ %bsp.202 = call i64* @pop_b1(i64* %bsp.201)
+ ret i64 %r
else.1:
- %bsp.300 = call i64* @pushI(i64 2, i64* %bsp.103)
- %bsp.301 = call i64* @push_b(i64 1, i64* %bsp.300)
- %bsp.302 = call i64* @subI(i64* %bsp.301)
-
- %arg.0 = call i64 @peek_b(i64* %bsp.302)
- %bsp.302.0 = call i64* @pop_b1(i64* %bsp.302)
- %r.0 = call i64 @s1(i64 %arg.0, i64** %globasp)
- %bsp.303 = call i64* @pushI(i64 %r.0, i64* %bsp.302.0)
-
- %bsp.304 = call i64* @pushI(i64 1, i64* %bsp.303)
- %bsp.305 = call i64* @push_b(i64 2, i64* %bsp.304)
- %bsp.306 = call i64* @subI(i64* %bsp.305)
-
- %arg.1 = call i64 @peek_b(i64* %bsp.306)
- %bsp.306.0 = call i64* @pop_b1(i64* %bsp.306)
- %r.1 = call i64 @s1(i64 %arg.1, i64** %globasp)
- %bsp.307 = call i64* @pushI(i64 %r.1, i64* %bsp.306.0)
-
- %bsp.308 = call i64* @addI(i64* %bsp.307)
- %bsp.309 = call i64* @pushI(i64 1, i64* %bsp.308)
- %bsp.310 = call i64* @push_b(i64 1, i64* %bsp.309)
- %bsp.311 = call i64* @update_b(i64 1, i64 2, i64* %bsp.310)
- %bsp.312 = call i64* @update_b(i64 0, i64 1, i64* %bsp.311)
- %bsp.313 = call i64* @pop_b1(i64* %bsp.312)
- %bsp.314 = call i64* @update_b(i64 1, i64 2, i64* %bsp.313)
- %bsp.315 = call i64* @updatepop_b01(i64* %bsp.314)
- %bsp.316 = call i64* @addI(i64* %bsp.315)
-
- %relse = call i64 @peek_b(i64* %bsp.316)
- %bsp.317 = call i64* @pop_b1(i64* %bsp.316)
- ret i64 %relse
+ %bsp.300 = call i64* @pushI(i64 2, i64* %bsp.103)
+ %bsp.301 = call i64* @push_b(i64 1, i64* %bsp.300)
+ %bsp.302 = call i64* @subI(i64* %bsp.301)
+
+ %arg.0 = call i64 @peek_b(i64* %bsp.302)
+ %bsp.302.0 = call i64* @pop_b1(i64* %bsp.302)
+ %r.0 = call i64 @s1(i64 %arg.0, i64** %globasp)
+ %bsp.303 = call i64* @pushI(i64 %r.0, i64* %bsp.302.0)
+
+ %bsp.304 = call i64* @pushI(i64 1, i64* %bsp.303)
+ %bsp.305 = call i64* @push_b(i64 2, i64* %bsp.304)
+ %bsp.306 = call i64* @subI(i64* %bsp.305)
+
+ %arg.1 = call i64 @peek_b(i64* %bsp.306)
+ %bsp.306.0 = call i64* @pop_b1(i64* %bsp.306)
+ %r.1 = call i64 @s1(i64 %arg.1, i64** %globasp)
+ %bsp.307 = call i64* @pushI(i64 %r.1, i64* %bsp.306.0)
+
+ %bsp.308 = call i64* @addI(i64* %bsp.307)
+ %bsp.309 = call i64* @pushI(i64 1, i64* %bsp.308)
+ %bsp.310 = call i64* @push_b(i64 1, i64* %bsp.309)
+ %bsp.311 = call i64* @update_b(i64 1, i64 2, i64* %bsp.310)
+ %bsp.312 = call i64* @update_b(i64 0, i64 1, i64* %bsp.311)
+ %bsp.313 = call i64* @pop_b1(i64* %bsp.312)
+ %bsp.314 = call i64* @update_b(i64 1, i64 2, i64* %bsp.313)
+ %bsp.315 = call i64* @updatepop_b01(i64* %bsp.314)
+ %bsp.316 = call i64* @addI(i64* %bsp.315)
+
+ %relse = call i64 @peek_b(i64* %bsp.316)
+ %bsp.317 = call i64* @pop_b1(i64* %bsp.316)
+ ret i64 %relse
}
define private i64 @_s2(i64 %arg, i64** %globasp) {
- %ret = tail call i64 @s1(i64 %arg, i64** %globasp)
- ret i64 %ret
+ %ret = tail call i64 @s1(i64 %arg, i64** %globasp)
+ ret i64 %ret
}
define i64 @main() {
- %heap = bitcast [10000 x i64]* @heap to i64*
- %astack = bitcast [10000 x i64*]* @astack to i64**
+ %heap = bitcast [10000 x i64]* @heap to i64*
+ %astack = bitcast [10000 x i64*]* @astack to i64**
- %r = call i64 @_s2(i64 43, i64** %astack)
+ %r = call i64 @_s2(i64 43, i64** %astack)
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %r)
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_c, i64 0, i64 0), i64 10)
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %r)
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_c, i64 0, i64 0), i64 10)
- ret i64 0
+ ret i64 0
}
diff --git a/rts.ll b/rts.ll
index 4ba7ddc..45d8ad5 100644
--- a/rts.ll
+++ b/rts.ll
@@ -12,204 +12,204 @@ attributes #0 = { alwaysinline }
define private i64** @_push_local_astack(i64** %asp.0, i64** %aspstart, i64** %globasp.0) #0 {
entry:
- br label %loop
+ br label %loop
loop:
- %asp = phi i64** [%asp.0, %entry], [%asp.1, %loop.0]
- %globasp = phi i64** [%globasp.0, %entry], [%globasp.1, %loop.0]
- %t.0 = icmp eq i64** %asp, %aspstart
- br i1 %t.0, label %done, label %loop.0
+ %asp = phi i64** [%asp.0, %entry], [%asp.1, %loop.0]
+ %globasp = phi i64** [%globasp.0, %entry], [%globasp.1, %loop.0]
+ %t.0 = icmp eq i64** %asp, %aspstart
+ br i1 %t.0, label %done, label %loop.0
done:
- ret i64** %globasp
+ ret i64** %globasp
loop.0:
- %globasp.1 = getelementptr i64*, i64** %globasp, i64 1
- %n = load i64*, i64** %asp
- store i64* %n, i64** %globasp.1
- %asp.1 = getelementptr i64*, i64** %asp, i64 -1
- br label %loop
+ %globasp.1 = getelementptr i64*, i64** %globasp, i64 1
+ %n = load i64*, i64** %asp
+ store i64* %n, i64** %globasp.1
+ %asp.1 = getelementptr i64*, i64** %asp, i64 -1
+ br label %loop
}
define private i64* @addI(i64* %bsp.0) #0 {
- %t.0 = load i64, i64* %bsp.0
- store i64 undef, i64* %bsp.0
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
- %t.1 = load i64, i64* %bsp.1
- %t.2 = add i64 %t.0, %t.1
- store i64 %t.2, i64* %bsp.1
- ret i64* %bsp.1
+ %t.0 = load i64, i64* %bsp.0
+ store i64 undef, i64* %bsp.0
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
+ %t.1 = load i64, i64* %bsp.1
+ %t.2 = add i64 %t.0, %t.1
+ store i64 %t.2, i64* %bsp.1
+ ret i64* %bsp.1
}
define private i64* @eqI_b(i64 %i, i64 %n, i64* %bsp.0) #0 {
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %n
- %bsp.2 = getelementptr i64, i64* %bsp.0, i64 -1
- %t.0 = load i64, i64* %bsp.1
- %t.1 = icmp eq i64 %t.0, %i
- %t.2 = zext i1 %t.1 to i64
- store i64 %t.2, i64* %bsp.2
- ret i64* %bsp.2
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %n
+ %bsp.2 = getelementptr i64, i64* %bsp.0, i64 -1
+ %t.0 = load i64, i64* %bsp.1
+ %t.1 = icmp eq i64 %t.0, %i
+ %t.2 = zext i1 %t.1 to i64
+ store i64 %t.2, i64* %bsp.2
+ ret i64* %bsp.2
}
define private i64** @fillI_b(i64 %b_offset, i64 %a_offset, i64* %bsp.0, i64** %asp.0) #0 {
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %b_offset
- %t.0 = load i64, i64* %bsp.1
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %b_offset
+ %t.0 = load i64, i64* %bsp.1
- %asp.1 = getelementptr i64*, i64** %asp.0, i64 %a_offset
+ %asp.1 = getelementptr i64*, i64** %asp.0, i64 %a_offset
- %n.0 = load i64*, i64** %asp.1
- %INT.0 = ptrtoint {i64, i64, i64*, i64, i8, i8, i8}* @INT to i64
- %INT.1 = add i64 %INT.0, 2
- store i64 %INT.1, i64* %n.0
+ %n.0 = load i64*, i64** %asp.1
+ %INT.0 = ptrtoint {i64, i64, i64*, i64, i8, i8, i8}* @INT to i64
+ %INT.1 = add i64 %INT.0, 2
+ store i64 %INT.1, i64* %n.0
- %n.1 = getelementptr i64, i64* %n.0, i64 1
- store i64 %t.0, i64* %n.1
+ %n.1 = getelementptr i64, i64* %n.0, i64 1
+ store i64 %t.0, i64* %n.1
- ret i64** %asp.0
+ ret i64** %asp.0
}
define private i64** @jsr_eval(i64 %n, i64** %asp.0, i64** %aspstart, i64** %globasp.0) #0 {
- ; TODO in case %n != 0 do we need to push it to the top of the stack?
- %asp.1 = getelementptr i64*, i64** %asp.0, i64 %n
+ ; TODO in case %n != 0 do we need to push it to the top of the stack?
+ %asp.1 = getelementptr i64*, i64** %asp.0, i64 %n
- %n.0 = load i64*, i64** %asp.1
- %d.0 = load i64, i64* %n.0
+ %n.0 = load i64*, i64** %asp.1
+ %d.0 = load i64, i64* %n.0
- %t.0 = and i64 %d.0, 2
- %t.1 = icmp eq i64 %t.0, 0
- br i1 %t.1, label %eval, label %done
+ %t.0 = and i64 %d.0, 2
+ %t.1 = icmp eq i64 %t.0, 0
+ br i1 %t.1, label %eval, label %done
done:
- ret i64** %asp.0
+ ret i64** %asp.0
eval:
- %globasp.1 = call i64** @_push_local_astack(i64** %asp.0, i64** %aspstart, i64** %globasp.0)
- %nentry.0 = inttoptr i64 %d.0 to i64*(i64*, i64**)*
- %n.1 = call i64* %nentry.0(i64* %n.0, i64** %globasp.1)
- store i64* %n.1, i64** %asp.1
- ret i64** %asp.0
+ %globasp.1 = call i64** @_push_local_astack(i64** %asp.0, i64** %aspstart, i64** %globasp.0)
+ %nentry.0 = inttoptr i64 %d.0 to i64*(i64*, i64**)*
+ %n.1 = call i64* %nentry.0(i64* %n.0, i64** %globasp.1)
+ store i64* %n.1, i64** %asp.1
+ ret i64** %asp.0
}
define private i64* @ltI(i64* %bsp.0) #0 {
- %t.0 = load i64, i64* %bsp.0
- store i64 undef, i64* %bsp.0
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
- %t.1 = load i64, i64* %bsp.1
- %t.2 = icmp slt i64 %t.0, %t.1
- %t.3 = zext i1 %t.2 to i64
- store i64 %t.3, i64* %bsp.1
- ret i64* %bsp.1
+ %t.0 = load i64, i64* %bsp.0
+ store i64 undef, i64* %bsp.0
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
+ %t.1 = load i64, i64* %bsp.1
+ %t.2 = icmp slt i64 %t.0, %t.1
+ %t.3 = zext i1 %t.2 to i64
+ store i64 %t.3, i64* %bsp.1
+ ret i64* %bsp.1
}
define private i64** @pop_a1(i64** %asp.0) #0 {
- store i64* undef, i64** %asp.0
- %asp.1 = getelementptr i64*, i64** %asp.0, i64 -1
- ret i64** %asp.1
+ store i64* undef, i64** %asp.0
+ %asp.1 = getelementptr i64*, i64** %asp.0, i64 -1
+ ret i64** %asp.1
}
define private i64* @pop_b1(i64* %bsp.0) #0 {
- store i64 undef, i64* %bsp.0
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
- ret i64* %bsp.1
+ store i64 undef, i64* %bsp.0
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
+ ret i64* %bsp.1
}
define private i64* @print_int(i64* %bsp.0) #0 {
- %t.0 = load i64, i64* %bsp.0
- store i64 undef, i64* %bsp.0
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %t.0)
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
- ret i64* %bsp.1
+ %t.0 = load i64, i64* %bsp.0
+ store i64 undef, i64* %bsp.0
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @printf_d, i64 0, i64 0), i64 %t.0)
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
+ ret i64* %bsp.1
}
define private i64* @push_b(i64 %n, i64* %bsp.0) #0 {
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %n
- %t.0 = load i64, i64* %bsp.1
- %bsp.2 = getelementptr i64, i64* %bsp.0, i64 -1
- store i64 %t.0, i64* %bsp.2
- ret i64* %bsp.2
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %n
+ %t.0 = load i64, i64* %bsp.1
+ %bsp.2 = getelementptr i64, i64* %bsp.0, i64 -1
+ store i64 %t.0, i64* %bsp.2
+ ret i64* %bsp.2
}
define private i64** @push_node(i64* %label, i64 %arity, i64** %asp.0) #0 {
entry:
- %n.0 = load i64*, i64** %asp.0
- %label.0 = ptrtoint i64* %label to i64
- store i64 %label.0, i64* %n.0
- br label %loop
+ %n.0 = load i64*, i64** %asp.0
+ %label.0 = ptrtoint i64* %label to i64
+ store i64 %label.0, i64* %n.0
+ br label %loop
loop:
- %asp.1 = phi i64** [%asp.0, %entry], [%asp.2, %loop.0]
- %arity.0 = phi i64 [%arity, %entry], [%arity.1, %loop.0]
- %t.0 = icmp eq i64 %arity.0, 0
- br i1 %t.0, label %done, label %loop.0
+ %asp.1 = phi i64** [%asp.0, %entry], [%asp.2, %loop.0]
+ %arity.0 = phi i64 [%arity, %entry], [%arity.1, %loop.0]
+ %t.0 = icmp eq i64 %arity.0, 0
+ br i1 %t.0, label %done, label %loop.0
done:
- ret i64** %asp.1
+ ret i64** %asp.1
loop.0:
- %n.1 = getelementptr i64, i64* %n.0, i64 %arity
- %n.2 = load i64, i64* %n.1
- %n.3 = inttoptr i64 %n.2 to i64*
- %asp.2 = getelementptr i64*, i64** %asp.1, i64 1
- store i64* %n.3, i64** %asp.2
- %arity.1 = sub i64 %arity.0, 1
- br label %loop
+ %n.1 = getelementptr i64, i64* %n.0, i64 %arity
+ %n.2 = load i64, i64* %n.1
+ %n.3 = inttoptr i64 %n.2 to i64*
+ %asp.2 = getelementptr i64*, i64** %asp.1, i64 1
+ store i64* %n.3, i64** %asp.2
+ %arity.1 = sub i64 %arity.0, 1
+ br label %loop
}
define private i64* @pushI(i64 %i, i64* %bsp.0) #0 {
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 -1
- store i64 %i, i64* %bsp.1
- ret i64* %bsp.1
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 -1
+ store i64 %i, i64* %bsp.1
+ ret i64* %bsp.1
}
define private i64* @pushI_a(i64 %n, i64* %bsp.0, i64** %asp.0) #0 {
- %asp.1 = getelementptr i64*, i64** %asp.0, i64 %n
- %n.0 = load i64*, i64** %asp.1
- %n.1 = getelementptr i64, i64* %n.0, i64 1
- %t.0 = load i64, i64* %n.1
+ %asp.1 = getelementptr i64*, i64** %asp.0, i64 %n
+ %n.0 = load i64*, i64** %asp.1
+ %n.1 = getelementptr i64, i64* %n.0, i64 1
+ %t.0 = load i64, i64* %n.1
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 -1
- store i64 %t.0, i64* %bsp.1
- ret i64* %bsp.1
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 -1
+ store i64 %t.0, i64* %bsp.1
+ ret i64* %bsp.1
}
define private i64* @subI(i64* %bsp.0) #0 {
- %t.0 = load i64, i64* %bsp.0
- store i64 undef, i64* %bsp.0
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
- %t.1 = load i64, i64* %bsp.1
- %t.2 = sub i64 %t.0, %t.1
- store i64 %t.2, i64* %bsp.1
- ret i64* %bsp.1
+ %t.0 = load i64, i64* %bsp.0
+ store i64 undef, i64* %bsp.0
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
+ %t.1 = load i64, i64* %bsp.1
+ %t.2 = sub i64 %t.0, %t.1
+ store i64 %t.2, i64* %bsp.1
+ ret i64* %bsp.1
}
define private i64* @update_b(i64 %n1, i64 %n2, i64* %bsp.0) #0 {
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %n1
- %t.0 = load i64, i64* %bsp.1
- %bsp.2 = getelementptr i64, i64* %bsp.0, i64 %n2
- store i64 %t.0, i64* %bsp.2
- ret i64* %bsp.0
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 %n1
+ %t.0 = load i64, i64* %bsp.1
+ %bsp.2 = getelementptr i64, i64* %bsp.0, i64 %n2
+ store i64 %t.0, i64* %bsp.2
+ ret i64* %bsp.0
}
define private i64* @updatepop_b01(i64* %bsp.0) #0 {
- %t.0 = load i64, i64* %bsp.0
- store i64 undef, i64* %bsp.0
- %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
- store i64 %t.0, i64* %bsp.1
- ret i64* %bsp.1
+ %t.0 = load i64, i64* %bsp.0
+ store i64 undef, i64* %bsp.0
+ %bsp.1 = getelementptr i64, i64* %bsp.0, i64 1
+ store i64 %t.0, i64* %bsp.1
+ ret i64* %bsp.1
}
define private i64* @peek_a(i64** %asp) #0 {
- %t = load i64*, i64** %asp
- ret i64* %t
+ %t = load i64*, i64** %asp
+ ret i64* %t
}
define private i64 @peek_b(i64* %bsp) #0 {
- %t = load i64, i64* %bsp
- ret i64 %t
+ %t = load i64, i64* %bsp
+ ret i64 %t
}
@INT = constant {i64, i64, i64*, i64, i8, i8, i8}
- {i64 0, i64 0, i64* inttoptr (i64 0 to i64*), i64 3, i8 73, i8 78, i8 84}
+ {i64 0, i64 0, i64* inttoptr (i64 0 to i64*), i64 3, i8 73, i8 78, i8 84}
define i64* @_cycle_in_spine(i64** %globasp) prefix {i8*, i64} {i8* inttoptr (i64 0 to i8*), i64 0} {
- call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @printf_cycle, i64 0, i64 0))
- unreachable
+ call i64 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @printf_cycle, i64 0, i64 0))
+ unreachable
}