Skip to content

Commit

Permalink
Fixed Anvil.countNumOfIncomingJumps to take into account *SP = ... ($…
Browse files Browse the repository at this point in the history
…ret) jump target.
  • Loading branch information
robby-phd committed Mar 6, 2025
1 parent be5dd32 commit 6bb38fd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions shared/src/main/scala/org/sireum/anvil/Anvil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1301,8 +1301,18 @@ import Anvil._

@pure def countNumOfIncomingJumps(blocks: ISZ[AST.IR.BasicBlock]): HashMap[Z, Z] = {
var r = HashMap ++ (for (b <- blocks) yield (b.label, z"0"))
for (b <- blocks; target <- b.jump.targets) {
r = r + target ~> (r.get(target).get + 1)
for (b <- blocks) {
for (g <- b.grounds) {
g match {
case AST.IR.Stmt.Intrinsic(Intrinsic.Store(
AST.IR.Exp.Intrinsic(Intrinsic.Register(T, _, _)), _, _, n: AST.IR.Exp.Int, _, _, _)) =>
r = r + n.value ~> (r.get(n.value).get + 1)
case _ =>
}
}
for (target <- b.jump.targets) {
r = r + target ~> (r.get(target).get + 1)
}
}
return r
}
Expand Down

0 comments on commit 6bb38fd

Please sign in to comment.