control flow graphs: introduce 'join' points for easy analyses based on abstract interpretation

This commit is contained in:
Andreas Rumpf 2019-01-21 14:35:49 +01:00
commit 11022fea1b
3 changed files with 395 additions and 154 deletions

View file

@ -184,7 +184,7 @@ proc isHarmlessVar*(s: PSym; c: Con): bool =
inc usages
#of useWithinCall:
# if c.g[i].sym == s: return false
of goto, fork:
of goto, fork, InstrKind.join:
discard "we do not perform an abstract interpretation yet"
result = usages <= 1
@ -246,6 +246,8 @@ proc isLastRead(n: PNode; c: var Con): bool =
if not takenForks.containsOrIncl(pc):
pcs.add pc + c.g[pc].dest
inc pc
of InstrKind.join:
inc pc
#echo c.graph.config $ n.info, " last read here!"
return true