Pseudocode: Introduce pseudo-value analysis

This commit is contained in:
Alexey Sedunov
2014-05-12 17:42:44 +04:00
parent 3ce96671d9
commit d2c055e9da
103 changed files with 2417 additions and 1432 deletions
@@ -7,26 +7,28 @@ fun foo(a: Int, b: Int) {
L0:
1 <START>
v(a: Int)
w(a)
magic(a: Int) -> <v0>
w(a|<v0>)
v(b: Int)
w(b)
magic(b: Int) -> <v1>
w(b|<v1>)
2 mark({ if (a == b) { } })
mark(if (a == b) { })
mark(a == b)
r(a)
r(b)
call(==, equals)
jf(L2) NEXT:[read (Unit), mark({ })]
r(a) -> <v2>
r(b) -> <v3>
call(==, equals|<v2>, <v3>) -> <v4>
jf(L2|<v4>) NEXT:[read (Unit), mark({ })]
3 mark({ })
read (Unit)
2 jmp(L3) NEXT:[<END>]
2 jmp(L3) NEXT:[<END>]
L2:
read (Unit) PREV:[jf(L2)]
read (Unit) PREV:[jf(L2|<v4>)]
L1:
L3:
1 <END> NEXT:[<SINK>] PREV:[jmp(L3), read (Unit)]
1 <END> NEXT:[<SINK>] PREV:[jmp(L3), read (Unit)]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -8,16 +8,16 @@ L0:
1 <START>
2 mark({ var i = 1 i++ })
v(var i = 1)
r(1)
w(i)
r(1) -> <v0>
w(i|<v0>)
mark(i++)
r(i)
call(++, inc)
w(i)
r(i) -> <v1>
call(++, inc|<v1>) -> <v2>
w(i|<v2>)
L1:
1 <END> NEXT:[<SINK>]
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -6,15 +6,16 @@ fun foo(f: () -> Unit) {
L0:
1 <START>
v(f: () -> Unit)
w(f)
magic(f: () -> Unit) -> <v0>
w(f|<v0>)
2 mark({ f() })
mark(f())
r(f)
call(f, invoke)
r(f) -> <v1>
call(f, invoke|<v1>) -> <v2>
L1:
1 <END> NEXT:[<SINK>]
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -6,26 +6,28 @@ fun neq(a: Int, b: Int) {
L0:
1 <START>
v(a: Int)
w(a)
magic(a: Int) -> <v0>
w(a|<v0>)
v(b: Int)
w(b)
magic(b: Int) -> <v1>
w(b|<v1>)
2 mark({ if (a != b) {} })
mark(if (a != b) {})
mark(a != b)
r(a)
r(b)
call(!=, equals)
jf(L2) NEXT:[read (Unit), mark({})]
r(a) -> <v2>
r(b) -> <v3>
call(!=, equals|<v2>, <v3>) -> <v4>
jf(L2|<v4>) NEXT:[read (Unit), mark({})]
3 mark({})
read (Unit)
2 jmp(L3) NEXT:[<END>]
2 jmp(L3) NEXT:[<END>]
L2:
read (Unit) PREV:[jf(L2)]
read (Unit) PREV:[jf(L2|<v4>)]
L1:
L3:
1 <END> NEXT:[<SINK>] PREV:[jmp(L3), read (Unit)]
1 <END> NEXT:[<SINK>] PREV:[jmp(L3), read (Unit)]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================