@@ -45,7 +45,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
4545 /** An SSA Phi definition, whose sign is the union of the signs of its inputs. */
4646 private class PhiSignDef extends FlowSignDef instanceof SemSsaPhiNode {
4747 final override Sign getSign ( ) {
48- exists ( SemSsaVariable inp , SemSsaReadPositionPhiInputEdge edge |
48+ exists ( SemSsaVariable inp , SsaReadPositionPhiInputEdge edge |
4949 edge .phiInput ( this , inp ) and
5050 result = semSsaSign ( inp , edge )
5151 )
@@ -170,11 +170,11 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
170170 override Sign getSignRestriction ( ) {
171171 // Propagate via SSA
172172 // Propagate the sign from the def of `v`, incorporating any inference from guards.
173- result = semSsaSign ( v , any ( SemSsaReadPositionBlock bb | bb .getAnExpr ( ) = this ) )
173+ result = semSsaSign ( v , any ( SsaReadPositionBlock bb | bb . getBlock ( ) .getAnExpr ( ) = this ) )
174174 or
175175 // No block for this read. Just use the sign of the def.
176176 // REVIEW: How can this happen?
177- not exists ( SemSsaReadPositionBlock bb | bb .getAnExpr ( ) = this ) and
177+ not exists ( SsaReadPositionBlock bb | bb . getBlock ( ) .getAnExpr ( ) = this ) and
178178 result = semSsaDefSign ( v )
179179 }
180180 }
@@ -290,7 +290,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
290290 * to only include bounds for which we might determine a sign.
291291 */
292292 private predicate lowerBound (
293- SemExpr lowerbound , SemSsaVariable v , SemSsaReadPosition pos , boolean isStrict
293+ SemExpr lowerbound , SemSsaVariable v , SsaReadPosition pos , boolean isStrict
294294 ) {
295295 exists ( boolean testIsTrue , SemRelationalExpr comp |
296296 pos .hasReadOfVar ( v ) and
@@ -314,7 +314,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
314314 * to only include bounds for which we might determine a sign.
315315 */
316316 private predicate upperBound (
317- SemExpr upperbound , SemSsaVariable v , SemSsaReadPosition pos , boolean isStrict
317+ SemExpr upperbound , SemSsaVariable v , SsaReadPosition pos , boolean isStrict
318318 ) {
319319 exists ( boolean testIsTrue , SemRelationalExpr comp |
320320 pos .hasReadOfVar ( v ) and
@@ -340,7 +340,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
340340 * - `isEq = true` : `v = eqbound`
341341 * - `isEq = false` : `v != eqbound`
342342 */
343- private predicate eqBound ( SemExpr eqbound , SemSsaVariable v , SemSsaReadPosition pos , boolean isEq ) {
343+ private predicate eqBound ( SemExpr eqbound , SemSsaVariable v , SsaReadPosition pos , boolean isEq ) {
344344 exists ( SemGuard guard , boolean testIsTrue , boolean polarity , SemExpr e |
345345 pos .hasReadOfVar ( pragma [ only_bind_into ] ( v ) ) and
346346 guardControlsSsaRead ( guard , pragma [ only_bind_into ] ( pos ) , testIsTrue ) and
@@ -355,7 +355,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
355355 * Holds if `bound` is a bound for `v` at `pos` that needs to be positive in
356356 * order for `v` to be positive.
357357 */
358- private predicate posBound ( SemExpr bound , SemSsaVariable v , SemSsaReadPosition pos ) {
358+ private predicate posBound ( SemExpr bound , SemSsaVariable v , SsaReadPosition pos ) {
359359 upperBound ( bound , v , pos , _) or
360360 eqBound ( bound , v , pos , true )
361361 }
@@ -364,7 +364,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
364364 * Holds if `bound` is a bound for `v` at `pos` that needs to be negative in
365365 * order for `v` to be negative.
366366 */
367- private predicate negBound ( SemExpr bound , SemSsaVariable v , SemSsaReadPosition pos ) {
367+ private predicate negBound ( SemExpr bound , SemSsaVariable v , SsaReadPosition pos ) {
368368 lowerBound ( bound , v , pos , _) or
369369 eqBound ( bound , v , pos , true )
370370 }
@@ -373,24 +373,24 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
373373 * Holds if `bound` is a bound for `v` at `pos` that can restrict whether `v`
374374 * can be zero.
375375 */
376- private predicate zeroBound ( SemExpr bound , SemSsaVariable v , SemSsaReadPosition pos ) {
376+ private predicate zeroBound ( SemExpr bound , SemSsaVariable v , SsaReadPosition pos ) {
377377 lowerBound ( bound , v , pos , _) or
378378 upperBound ( bound , v , pos , _) or
379379 eqBound ( bound , v , pos , _)
380380 }
381381
382382 /** Holds if `bound` allows `v` to be positive at `pos`. */
383- private predicate posBoundOk ( SemExpr bound , SemSsaVariable v , SemSsaReadPosition pos ) {
383+ private predicate posBoundOk ( SemExpr bound , SemSsaVariable v , SsaReadPosition pos ) {
384384 posBound ( bound , v , pos ) and TPos ( ) = semExprSign ( bound )
385385 }
386386
387387 /** Holds if `bound` allows `v` to be negative at `pos`. */
388- private predicate negBoundOk ( SemExpr bound , SemSsaVariable v , SemSsaReadPosition pos ) {
388+ private predicate negBoundOk ( SemExpr bound , SemSsaVariable v , SsaReadPosition pos ) {
389389 negBound ( bound , v , pos ) and TNeg ( ) = semExprSign ( bound )
390390 }
391391
392392 /** Holds if `bound` allows `v` to be zero at `pos`. */
393- private predicate zeroBoundOk ( SemExpr bound , SemSsaVariable v , SemSsaReadPosition pos ) {
393+ private predicate zeroBoundOk ( SemExpr bound , SemSsaVariable v , SsaReadPosition pos ) {
394394 lowerBound ( bound , v , pos , _) and TNeg ( ) = semExprSign ( bound )
395395 or
396396 lowerBound ( bound , v , pos , false ) and TZero ( ) = semExprSign ( bound )
@@ -408,7 +408,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
408408 * Holds if there is a bound that might restrict whether `v` has the sign `s`
409409 * at `pos`.
410410 */
411- private predicate hasGuard ( SemSsaVariable v , SemSsaReadPosition pos , Sign s ) {
411+ private predicate hasGuard ( SemSsaVariable v , SsaReadPosition pos , Sign s ) {
412412 s = TPos ( ) and posBound ( _, v , pos )
413413 or
414414 s = TNeg ( ) and negBound ( _, v , pos )
@@ -421,7 +421,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
421421 * might be ruled out by a guard.
422422 */
423423 pragma [ noinline]
424- private Sign guardedSsaSign ( SemSsaVariable v , SemSsaReadPosition pos ) {
424+ private Sign guardedSsaSign ( SemSsaVariable v , SsaReadPosition pos ) {
425425 result = semSsaDefSign ( v ) and
426426 pos .hasReadOfVar ( v ) and
427427 hasGuard ( v , pos , result )
@@ -432,7 +432,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
432432 * can rule it out.
433433 */
434434 pragma [ noinline]
435- private Sign unguardedSsaSign ( SemSsaVariable v , SemSsaReadPosition pos ) {
435+ private Sign unguardedSsaSign ( SemSsaVariable v , SsaReadPosition pos ) {
436436 result = semSsaDefSign ( v ) and
437437 pos .hasReadOfVar ( v ) and
438438 not hasGuard ( v , pos , result )
@@ -443,7 +443,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
443443 * ruled out the sign but does not.
444444 * This does not check that the definition of `v` also allows the sign.
445445 */
446- private Sign guardedSsaSignOk ( SemSsaVariable v , SemSsaReadPosition pos ) {
446+ private Sign guardedSsaSignOk ( SemSsaVariable v , SsaReadPosition pos ) {
447447 result = TPos ( ) and
448448 forex ( SemExpr bound | posBound ( bound , v , pos ) | posBoundOk ( bound , v , pos ) )
449449 or
@@ -455,7 +455,7 @@ module SignAnalysis<DeltaSig D, UtilSig<Sem, D> Utils> {
455455 }
456456
457457 /** Gets a possible sign for `v` at `pos`. */
458- private Sign semSsaSign ( SemSsaVariable v , SemSsaReadPosition pos ) {
458+ private Sign semSsaSign ( SemSsaVariable v , SsaReadPosition pos ) {
459459 result = unguardedSsaSign ( v , pos )
460460 or
461461 result = guardedSsaSign ( v , pos ) and
0 commit comments