@@ -168,6 +168,29 @@ final class BasicBlock extends BasicBlocksImpl::BasicBlock {
168168 */
169169 BasicBlock getImmediateDominator ( ) { result = super .getImmediateDominator ( ) }
170170
171+ /**
172+ * Holds if the edge with successor type `s` out of this basic block is a
173+ * dominating edge for `dominated`.
174+ *
175+ * That is, all paths reaching `dominated` from the entry point basic
176+ * block must go through the `s` edge out of this basic block.
177+ *
178+ * Edge dominance is similar to node dominance except it concerns edges
179+ * instead of nodes: A basic block is dominated by a _basic block_ `bb` if it
180+ * can only be reached through `bb` and dominated by an _edge_ `s` if it can
181+ * only be reached through `s`.
182+ *
183+ * Note that where all basic blocks (except the entry basic block) are
184+ * strictly dominated by at least one basic block, a basic block may not be
185+ * dominated by any edge. If an edge dominates a basic block `bb`, then
186+ * both endpoints of the edge dominates `bb`. The converse is not the case,
187+ * as there may be multiple paths between the endpoints with none of them
188+ * dominating.
189+ */
190+ predicate edgeDominates ( BasicBlock dominated , SuccessorType s ) {
191+ super .edgeDominates ( dominated , s )
192+ }
193+
171194 /**
172195 * Holds if this basic block strictly post-dominates basic block `bb`.
173196 *
@@ -253,16 +276,19 @@ final class ConditionBlock extends BasicBlock, BasicBlocksImpl::ConditionBasicBl
253276 * successor of this block, and `succ` can only be reached from
254277 * the callable entry point by going via the `s` edge out of this basic block.
255278 */
256- predicate immediatelyControls ( BasicBlock succ , ConditionalSuccessor s ) {
257- super .immediatelyControls ( succ , s )
279+ deprecated predicate immediatelyControls ( BasicBlock succ , ConditionalSuccessor s ) {
280+ this .getASuccessor ( s ) = succ and
281+ BasicBlocksImpl:: dominatingEdge ( this , succ )
258282 }
259283
260284 /**
285+ * DEPRECATED: Use `edgeDominates` instead.
286+ *
261287 * Holds if basic block `controlled` is controlled by this basic block with
262288 * conditional value `s`. That is, `controlled` can only be reached from the
263289 * callable entry point by going via the `s` edge out of this basic block.
264290 */
265- predicate controls ( BasicBlock controlled , ConditionalSuccessor s ) {
266- super .controls ( controlled , s )
291+ deprecated predicate controls ( BasicBlock controlled , ConditionalSuccessor s ) {
292+ super .edgeDominates ( controlled , s )
267293 }
268294}
0 commit comments