BasicBlock: Replace entryBlock predicate with subclass.

This commit is contained in:
Anders Schack-Mulligen
2025-09-01 11:47:33 +02:00
parent e2eb6dbbf2
commit 09b2c5abf0
13 changed files with 54 additions and 29 deletions

View File

@@ -1295,12 +1295,14 @@ module Cfg implements BB::CfgSig<Location> {
}
}
class EntryBasicBlock extends BasicBlock {
EntryBasicBlock() { this.getNode(0).isEntryNode() }
}
pragma[nomagic]
predicate dominatingEdge(BasicBlock bb1, BasicBlock bb2) {
bb1.getASuccessor() = bb2 and
bb1 = bb2.getImmediateDominator() and
forall(BasicBlock pred | pred = bb2.getAPredecessor() and pred != bb1 | bb2.dominates(pred))
}
predicate entryBlock(BasicBlock bb) { bb.getNode(0).isEntryNode() }
}