Mark some expressions after processing their components
when it's semantically correct Expressions: calls, 'for' loops, elvis operators It's significant for reporting 'unreachable code' correctly
This commit is contained in:
@@ -20,9 +20,9 @@ L4 [body entry point]:
|
||||
r(2) -> <v1>
|
||||
w(a|<v1>)
|
||||
L5 [condition entry point]:
|
||||
mark(a > 0)
|
||||
r(a) -> <v2>
|
||||
r(0) -> <v3>
|
||||
mark(a > 0)
|
||||
call(>, compareTo|<v2>, <v3>) -> <v4>
|
||||
jt(L2 [loop entry point]|<v4>) USE: in: {a=READ} out: {a=READ}
|
||||
L3 [loop exit point]:
|
||||
|
||||
@@ -12,10 +12,9 @@ L0:
|
||||
2 mark({ "before" for (i in 1..10) { val a = i } "after" })
|
||||
mark("before")
|
||||
r("before") -> <v0> USE: in: {} out: {}
|
||||
3 mark(for (i in 1..10) { val a = i })
|
||||
mark(1..10)
|
||||
r(1) -> <v1>
|
||||
3 r(1) -> <v1>
|
||||
r(10) -> <v2>
|
||||
mark(1..10)
|
||||
call(.., rangeTo|<v1>, <v2>) -> <v3>
|
||||
v(i) INIT: in: {} out: {i=D}
|
||||
L3:
|
||||
@@ -24,7 +23,8 @@ L4 [loop entry point]:
|
||||
L5 [body entry point]:
|
||||
magic(1..10|<v3>) -> <v4>
|
||||
w(i|<v4>) INIT: in: {i=D} out: {i=ID}
|
||||
4 mark({ val a = i }) INIT: in: {i=ID} out: {i=ID}
|
||||
mark(for (i in 1..10) { val a = i }) INIT: in: {i=ID} out: {i=ID}
|
||||
4 mark({ val a = i })
|
||||
v(val a = i) INIT: in: {i=ID} out: {a=D, i=ID}
|
||||
r(i) -> <v5> INIT: in: {a=D, i=ID} out: {a=D, i=ID}
|
||||
w(a|<v5>) INIT: in: {a=D, i=ID} out: {a=ID, i=ID}
|
||||
|
||||
@@ -43,10 +43,10 @@ L3:
|
||||
magic(x: Int) -> <v0> INIT: in: {x=D} out: {x=D}
|
||||
w(x|<v0>) INIT: in: {x=D} out: {x=ID}
|
||||
4 mark(val a = x + b) INIT: in: {x=ID} out: {x=ID}
|
||||
v(val a = x + b) INIT: in: {x=ID} out: {a=D, x=ID}
|
||||
mark(x + b) INIT: in: {a=D, x=ID} out: {a=D, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
|
||||
r(x) -> <v1> USE: in: {b=READ} out: {b=READ, x=READ}
|
||||
v(val a = x + b) INIT: in: {x=ID} out: {a=D, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
|
||||
r(x) -> <v1> INIT: in: {a=D, x=ID} out: {a=D, x=ID} USE: in: {b=READ} out: {b=READ, x=READ}
|
||||
r(b) -> <v2> USE: in: {} out: {b=READ}
|
||||
mark(x + b)
|
||||
call(+, plus|<v1>, <v2>) -> <v3>
|
||||
w(a|<v3>) INIT: in: {a=D, x=ID} out: {a=ID, x=ID}
|
||||
L4:
|
||||
|
||||
@@ -39,10 +39,10 @@ L3:
|
||||
magic(x: Int) -> <v0> INIT: in: {x=D} out: {x=D}
|
||||
w(x|<v0>) INIT: in: {x=D} out: {x=ID}
|
||||
4 mark({ val a = x + b }) INIT: in: {x=ID} out: {x=ID}
|
||||
v(val a = x + b) INIT: in: {x=ID} out: {a=D, x=ID}
|
||||
mark(x + b) INIT: in: {a=D, x=ID} out: {a=D, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
|
||||
r(x) -> <v1> USE: in: {b=READ} out: {b=READ, x=READ}
|
||||
v(val a = x + b) INIT: in: {x=ID} out: {a=D, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
|
||||
r(x) -> <v1> INIT: in: {a=D, x=ID} out: {a=D, x=ID} USE: in: {b=READ} out: {b=READ, x=READ}
|
||||
r(b) -> <v2> USE: in: {} out: {b=READ}
|
||||
mark(x + b)
|
||||
call(+, plus|<v1>, <v2>) -> <v3>
|
||||
w(a|<v3>) INIT: in: {a=D, x=ID} out: {a=ID, x=ID}
|
||||
L4:
|
||||
|
||||
+3
-3
@@ -33,10 +33,10 @@ L3:
|
||||
3 <START> INIT: in: {} out: {}
|
||||
v(x: Int) INIT: in: {} out: {x=D}
|
||||
magic(x: Int) -> <v0> INIT: in: {x=D} out: {x=D}
|
||||
w(x|<v0>) INIT: in: {x=D} out: {x=ID}
|
||||
mark(x + b) INIT: in: {x=ID} out: {x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
|
||||
r(x) -> <v1> USE: in: {b=READ} out: {b=READ, x=READ}
|
||||
w(x|<v0>) INIT: in: {x=D} out: {x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
|
||||
r(x) -> <v1> INIT: in: {x=ID} out: {x=ID} USE: in: {b=READ} out: {b=READ, x=READ}
|
||||
r(b) -> <v2> USE: in: {} out: {b=READ}
|
||||
mark(x + b)
|
||||
call(+, plus|<v1>, <v2>) -> <v3>
|
||||
L4:
|
||||
<END>
|
||||
|
||||
@@ -12,10 +12,10 @@ L0:
|
||||
2 mark({ "before" while (true) { val a: Int } "after" })
|
||||
mark("before")
|
||||
r("before") -> <v0>
|
||||
mark(while (true) { val a: Int })
|
||||
L2 [loop entry point]:
|
||||
L5 [condition entry point]:
|
||||
r(true) -> <v1>
|
||||
mark(while (true) { val a: Int })
|
||||
L4 [body entry point]:
|
||||
3 mark({ val a: Int })
|
||||
v(val a: Int) INIT: in: {} out: {a=D}
|
||||
|
||||
Reference in New Issue
Block a user