@@ -926,30 +926,14 @@ private module SsaInput implements SsaImplCommon::InputSig<Location> {
926926 */
927927cached
928928module SsaCached {
929- /**
930- * Holds if the node at index `i` in `bb` is a last reference to SSA definition
931- * `def`. The reference is last because it can reach another write `next`,
932- * without passing through another read or write.
933- *
934- * The path from node `i` in `bb` to `next` goes via basic block `input`,
935- * which is either a predecessor of the basic block of `next`, or `input` =
936- * `bb` in case `next` occurs in basic block `bb`.
937- */
938- cached
939- predicate lastRefRedefExt (
940- DefinitionExt def , SourceVariable sv , IRBlock bb , int i , IRBlock input , DefinitionExt next
941- ) {
942- SsaImpl:: lastRefRedefExt ( def , sv , bb , i , input , next )
943- }
944-
945929 cached
946- predicate ssaDefReachesReadExt ( SourceVariable v , DefinitionExt def , IRBlock bb , int i ) {
947- SsaImpl:: ssaDefReachesReadExt ( v , def , bb , i )
930+ predicate ssaDefReachesRead ( SourceVariable v , Definition def , IRBlock bb , int i ) {
931+ SsaImpl:: ssaDefReachesRead ( v , def , bb , i )
948932 }
949933
950934 cached
951- predicate ssaDefReachesRead ( SourceVariable v , Definition def , IRBlock bb , int i ) {
952- SsaImpl:: ssaDefReachesRead ( v , def , bb , i )
935+ predicate phiHasInputFromBlock ( PhiNode phi , Definition inp , IRBlock bb ) {
936+ SsaImpl:: phiHasInputFromBlock ( phi , inp , bb )
953937 }
954938
955939 predicate variableRead = SsaInput:: variableRead / 4 ;
@@ -1102,77 +1086,17 @@ predicate ssaFlow(Node nodeFrom, Node nodeTo) {
11021086
11031087/**
11041088 * An static single assignment (SSA) phi node.
1105- *
1106- * This is either a normal phi node or a phi-read node.
11071089 */
1108- class PhiNode extends SsaImpl:: DefinitionExt {
1109- PhiNode ( ) {
1110- this instanceof SsaImpl:: PhiNode or
1111- this instanceof SsaImpl:: PhiReadNode
1112- }
1113-
1114- /**
1115- * Holds if this phi node is a phi-read node.
1116- *
1117- * Phi-read nodes are like normal phi nodes, but they are inserted based
1118- * on reads instead of writes.
1119- */
1120- predicate isPhiRead ( ) { this instanceof SsaImpl:: PhiReadNode }
1121-
1122- /**
1123- * Holds if the node at index `i` in `bb` is a last reference to SSA
1124- * definition `def` of `sv`. The reference is last because it can reach
1125- * this phi node, without passing through another read or write.
1126- *
1127- * The path from node `i` in `bb` to this phi node goes via basic block
1128- * `input`, which is either a predecessor of the basic block of this phi
1129- * node, or `input` = `bb` in case this phi node occurs in basic block `bb`.
1130- */
1131- predicate hasInputFromBlock ( DefinitionExt def , SourceVariable sv , IRBlock bb , int i , IRBlock input ) {
1132- SsaCached:: lastRefRedefExt ( def , sv , bb , i , input , this )
1133- }
1134-
1090+ class PhiNode extends Definition instanceof SsaImpl:: PhiNode {
11351091 /** Gets a definition that is an input to this phi node. */
1136- final DefinitionExt getAnInput ( ) { this . hasInputFromBlock ( result , _ , _ , _ , _) }
1092+ final Definition getAnInput ( ) { phiHasInputFromBlock ( this , result , _) }
11371093}
11381094
11391095/** An static single assignment (SSA) definition. */
11401096class Definition extends SsaImpl:: Definition {
1141- /**
1142- * INTERNAL: Do not use.
1143- */
1144- Node0Impl getValue ( ) { result = getDefImpl ( this ) .getValue ( ) }
1145-
1146- /** Gets the indirection index of this definition. */
1147- int getIndirectionIndex ( ) { result = getDefImpl ( this ) .getIndirectionIndex ( ) }
1148-
1149- /** Gets the indirection of this definition. */
1150- int getIndirection ( ) { result = getDefImpl ( this ) .getIndirection ( ) }
1151-
1152- /**
1153- * Holds if this definition is guaranteed to totally overwrite the buffer
1154- * being written to.
1155- */
1156- predicate isCertain ( ) { getDefImpl ( this ) .isCertain ( ) }
1157-
1158- /**
1159- * Gets the enclosing declaration of this definition.
1160- *
1161- * Note that this may be a variable when this definition defines a global, or
1162- * a static local, variable.
1163- */
1164- Declaration getFunction ( ) { result = getDefImpl ( this ) .getBlock ( ) .getEnclosingFunction ( ) }
1165-
1166- /** Gets the underlying type of the variable being defined by this definition. */
1167- Type getUnderlyingType ( ) { result = this .getSourceVariable ( ) .getType ( ) }
1168-
1169- /** Gets the unspecified type of the variable being defined by this definition. */
1170- Type getUnspecifiedType ( ) { result = this .getUnderlyingType ( ) .getUnspecifiedType ( ) }
1171- }
1172-
1173- /** An static single assignment (SSA) definition. */
1174- class DefinitionExt extends SsaImpl:: DefinitionExt {
1175- private DefinitionExt getAPhiInputOrPriorDefinition ( ) { result = this .( PhiNode ) .getAnInput ( ) }
1097+ // TODO: Include prior definitions of uncertain writes or rename predicate
1098+ // i.e. the disjunct `SsaImpl::uncertainWriteDefinitionInput(this, result)`
1099+ private Definition getAPhiInputOrPriorDefinition ( ) { result = this .( PhiNode ) .getAnInput ( ) }
11761100
11771101 /**
11781102 * Gets a definition that ultimately defines this SSA definition and is
0 commit comments