SSA: Add SsaNode predicates that don't mention DefinitionExt.

This commit is contained in:
Anders Schack-Mulligen
2025-02-21 14:43:51 +01:00
parent 1c616d10d4
commit 9acb58e8c2

View File

@@ -1715,6 +1715,15 @@ module Make<LocationSig Location, InputSig<Location> Input> {
abstract private class SsaNodeImpl extends NodeImpl {
/** Gets the underlying SSA definition. */
abstract DefinitionExt getDefinitionExt();
/** Gets the SSA definition this node corresponds to, if any. */
Definition asDefinition() { this = TSsaDefinitionNode(result) }
/** Gets the basic block to which this node belongs. */
abstract BasicBlock getBasicBlock();
/** Gets the underlying source variable that this node tracks flow for. */
abstract SourceVariable getSourceVariable();
}
final class SsaNode = SsaNodeImpl;
@@ -1727,6 +1736,10 @@ module Make<LocationSig Location, InputSig<Location> Input> {
override DefinitionExt getDefinitionExt() { result = def }
override BasicBlock getBasicBlock() { result = def.getBasicBlock() }
override SourceVariable getSourceVariable() { result = def.getSourceVariable() }
override Location getLocation() { result = def.getLocation() }
override string toString() { result = def.toString() }
@@ -1783,6 +1796,10 @@ module Make<LocationSig Location, InputSig<Location> Input> {
override SsaInputDefinitionExt getDefinitionExt() { result = def_ }
override BasicBlock getBasicBlock() { result = input_ }
override SourceVariable getSourceVariable() { result = def_.getSourceVariable() }
override Location getLocation() { result = input_.getNode(input_.length() - 1).getLocation() }
override string toString() { result = "[input] " + def_.toString() }