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:
Svetlana Isakova
2014-06-12 12:58:57 +04:00
parent 6e622f2301
commit 9480907514
39 changed files with 181 additions and 178 deletions
@@ -14,14 +14,14 @@ L0:
2 mark({ val b: Boolean if (1 < 2) { use(b) } else { b = true } })
v(val b: Boolean) INIT: in: {} out: {b=D}
mark(if (1 < 2) { use(b) } else { b = true }) INIT: in: {b=D} out: {b=D}
mark(1 < 2)
r(1) -> <v0>
r(2) -> <v1>
mark(1 < 2)
call(<, compareTo|<v0>, <v1>) -> <v2>
jf(L2|<v2>)
3 mark({ use(b) })
mark(use(b)) USE: in: {b=READ} out: {b=READ}
3 mark({ use(b) }) USE: in: {b=READ} out: {b=READ}
r(b) -> <v3> USE: in: {} out: {b=READ}
mark(use(b))
call(use, use|<v3>) -> <v4>
2 jmp(L3) USE: in: {} out: {}
L2:
@@ -39,14 +39,14 @@ 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 y = x + a use(a)) INIT: in: {x=ID} out: {x=ID}
v(val y = x + a) INIT: in: {x=ID} out: {x=ID, y=D}
mark(x + a) INIT: in: {x=ID, y=D} out: {x=ID, y=D} USE: in: {a=READ, x=READ} out: {a=READ, x=READ}
r(x) -> <v1> USE: in: {a=READ} out: {a=READ, x=READ}
v(val y = x + a) INIT: in: {x=ID} out: {x=ID, y=D} USE: in: {a=READ, x=READ} out: {a=READ, x=READ}
r(x) -> <v1> INIT: in: {x=ID, y=D} out: {x=ID, y=D} USE: in: {a=READ} out: {a=READ, x=READ}
r(a) -> <v2>
mark(x + a)
call(+, plus|<v1>, <v2>) -> <v3>
w(y|<v3>) INIT: in: {x=ID, y=D} out: {x=ID, y=ID}
mark(use(a)) INIT: in: {x=ID, y=ID} out: {x=ID, y=ID} USE: in: {a=READ} out: {a=READ}
r(a) -> <v4> USE: in: {} out: {a=READ}
w(y|<v3>) INIT: in: {x=ID, y=D} out: {x=ID, y=ID} USE: in: {a=READ} out: {a=READ}
r(a) -> <v4> INIT: in: {x=ID, y=ID} out: {x=ID, y=ID} USE: in: {} out: {a=READ}
mark(use(a))
call(use, use|<v4>) -> <v5>
L4:
3 <END> INIT: in: {x=ID} out: {x=ID}
@@ -11,14 +11,14 @@ L0:
2 mark({ var a = 1 use(a) a = 2 use(a) })
v(var a = 1) INIT: in: {} out: {a=D}
r(1) -> <v0> INIT: in: {a=D} out: {a=D}
w(a|<v0>) INIT: in: {a=D} out: {a=ID}
mark(use(a)) INIT: in: {a=ID} out: {a=ID} USE: in: {a=READ} out: {a=READ}
r(a) -> <v1> USE: in: {a=WRITTEN_AFTER_READ} out: {a=READ}
w(a|<v0>) INIT: in: {a=D} out: {a=ID} USE: in: {a=READ} out: {a=READ}
r(a) -> <v1> INIT: in: {a=ID} out: {a=ID} USE: in: {a=WRITTEN_AFTER_READ} out: {a=READ}
mark(use(a))
call(use, use|<v1>) -> <v2>
r(2) -> <v3> USE: in: {a=WRITTEN_AFTER_READ} out: {a=WRITTEN_AFTER_READ}
w(a|<v3>) USE: in: {a=READ} out: {a=WRITTEN_AFTER_READ}
mark(use(a)) USE: in: {a=READ} out: {a=READ}
r(a) -> <v4> USE: in: {} out: {a=READ}
mark(use(a))
call(use, use|<v4>) -> <v5>
L1:
1 <END> INIT: in: {} out: {}