@@ -9,7 +9,10 @@ signature module InputSig {
99 * A basic block, that is, a maximal straight-line sequence of control flow nodes
1010 * without branches or joins.
1111 */
12- class BasicBlock ;
12+ class BasicBlock {
13+ /** Gets a textual representation of this basic block. */
14+ string toString ( ) ;
15+ }
1316
1417 /**
1518 * Gets the basic block that immediately dominates basic block `bb`, if any.
@@ -43,7 +46,10 @@ signature module InputSig {
4346 class ExitBasicBlock extends BasicBlock ;
4447
4548 /** A variable that can be SSA converted. */
46- class SourceVariable ;
49+ class SourceVariable {
50+ /** Gets a textual representation of this variable. */
51+ string toString ( ) ;
52+ }
4753
4854 /**
4955 * Holds if the `i`th node of basic block `bb` is a (potential) write to source
@@ -844,8 +850,6 @@ module Make<InputSig Input> {
844850 }
845851
846852 /** Provides a set of consistency queries. */
847- // TODO: Make these `query` predicates once class signatures are supported
848- // (`SourceVariable` and `BasicBlock` must have `toString`)
849853 module Consistency {
850854 /** A definition that is relevant for the consistency queries. */
851855 abstract class RelevantDefinition extends Definition {
@@ -856,27 +860,27 @@ module Make<InputSig Input> {
856860 }
857861
858862 /** Holds if a read can be reached from multiple definitions. */
859- predicate nonUniqueDef ( RelevantDefinition def , SourceVariable v , BasicBlock bb , int i ) {
863+ query predicate nonUniqueDef ( RelevantDefinition def , SourceVariable v , BasicBlock bb , int i ) {
860864 ssaDefReachesRead ( v , def , bb , i ) and
861865 not exists ( unique( Definition def0 | ssaDefReachesRead ( v , def0 , bb , i ) ) )
862866 }
863867
864868 /** Holds if a read cannot be reached from a definition. */
865- predicate readWithoutDef ( SourceVariable v , BasicBlock bb , int i ) {
869+ query predicate readWithoutDef ( SourceVariable v , BasicBlock bb , int i ) {
866870 variableRead ( bb , i , v , _) and
867871 not ssaDefReachesRead ( v , _, bb , i )
868872 }
869873
870874 /** Holds if a definition cannot reach a read. */
871- predicate deadDef ( RelevantDefinition def , SourceVariable v ) {
875+ query predicate deadDef ( RelevantDefinition def , SourceVariable v ) {
872876 v = def .getSourceVariable ( ) and
873877 not ssaDefReachesRead ( _, def , _, _) and
874878 not phiHasInputFromBlock ( _, def , _) and
875879 not uncertainWriteDefinitionInput ( _, def )
876880 }
877881
878882 /** Holds if a read is not dominated by a definition. */
879- predicate notDominatedByDef ( RelevantDefinition def , SourceVariable v , BasicBlock bb , int i ) {
883+ query predicate notDominatedByDef ( RelevantDefinition def , SourceVariable v , BasicBlock bb , int i ) {
880884 exists ( BasicBlock bbDef , int iDef | def .definesAt ( v , bbDef , iDef ) |
881885 ssaDefReachesReadWithinBlock ( v , def , bb , i ) and
882886 ( bb != bbDef or i < iDef )
0 commit comments