@@ -109,125 +109,6 @@ private predicate localTaintStep(DataFlowNode src, DataFlowNode sink) {
109109 src = sink .( UnaryBitwiseOperation ) .getOperand ( )
110110}
111111
112- deprecated module DefUse {
113- /**
114- * A classification of variable references into reads and writes.
115- */
116- private newtype RefKind =
117- Read ( ) or
118- Write ( )
119-
120- /**
121- * Holds if the `i`th node of basic block `bb` is a reference to `v`,
122- * either a read (when `k` is `Read()`) or a write (when `k` is `Write()`).
123- */
124- private predicate ref ( BasicBlock bb , int i , StackVariable v , RefKind k ) {
125- exists ( ReadAccess ra | bb .getNode ( i ) = ra |
126- ra .getTarget ( ) = v and
127- k = Read ( )
128- )
129- or
130- exists ( VariableUpdate vu | bb .getNode ( i ) = vu |
131- vu .getVariable ( ) = v and
132- k = Write ( )
133- )
134- }
135-
136- /**
137- * Gets the (1-based) rank of the reference to `v` at the `i`th node of
138- * basic block `bb`, which has the given reference kind `k`.
139- */
140- private int refRank ( BasicBlock bb , int i , StackVariable v , RefKind k ) {
141- i = rank [ result ] ( int j | ref ( bb , j , v , _) ) and
142- ref ( bb , i , v , k )
143- }
144-
145- /**
146- * Holds if stack variable `v` is live at the beginning of basic block `bb`.
147- */
148- private predicate liveAtEntry ( BasicBlock bb , StackVariable v ) {
149- // The first reference to `v` inside `bb` is a read
150- refRank ( bb , _, v , Read ( ) ) = 1
151- or
152- // There is no reference to `v` inside `bb`, but `v` is live at entry
153- // to a successor basic block of `bb`
154- not exists ( refRank ( bb , _, v , _) ) and
155- liveAtExit ( bb , v )
156- }
157-
158- /**
159- * Holds if stack variable `v` is live at the end of basic block `bb`.
160- */
161- private predicate liveAtExit ( BasicBlock bb , StackVariable v ) {
162- liveAtEntry ( bb .getASuccessor ( ) , v )
163- }
164-
165- /**
166- * Holds if the variable update `vu` reaches rank index `rankix`
167- * in its own basic block `bb`.
168- */
169- private predicate defReachesRank ( BasicBlock bb , VariableUpdate vu , int rankix , StackVariable v ) {
170- exists ( int i |
171- rankix = refRank ( bb , i , v , Write ( ) ) and
172- vu = bb .getNode ( i )
173- )
174- or
175- defReachesRank ( bb , vu , rankix - 1 , v ) and
176- rankix = refRank ( bb , _, v , Read ( ) )
177- }
178-
179- /**
180- * Holds if the variable update `vu` of stack variable `v` reaches the
181- * end of a basic block `bb`, at which point it is still live, without
182- * crossing another update.
183- */
184- private predicate defReachesEndOfBlock ( BasicBlock bb , VariableUpdate vu , StackVariable v ) {
185- liveAtExit ( bb , v ) and
186- (
187- exists ( int last | last = max ( refRank ( bb , _, v , _) ) | defReachesRank ( bb , vu , last , v ) )
188- or
189- defReachesStartOfBlock ( bb , vu , v ) and
190- not exists ( refRank ( bb , _, v , Write ( ) ) )
191- )
192- }
193-
194- pragma [ noinline]
195- private predicate defReachesStartOfBlock ( BasicBlock bb , VariableUpdate vu , StackVariable v ) {
196- defReachesEndOfBlock ( bb .getAPredecessor ( ) , vu , v )
197- }
198-
199- /**
200- * Holds if the variable update `vu` of stack variable `v` reaches `read` in the
201- * same basic block without crossing another update of `v`.
202- */
203- private predicate defReachesReadWithinBlock ( StackVariable v , VariableUpdate vu , ReadAccess read ) {
204- exists ( BasicBlock bb , int rankix , int i |
205- defReachesRank ( bb , vu , rankix , v ) and
206- rankix = refRank ( bb , i , v , Read ( ) ) and
207- read = bb .getNode ( i )
208- )
209- }
210-
211- /** Holds if the variable update `vu` can be used at the read `use`. */
212- cached
213- deprecated predicate variableUpdateUse ( StackVariable target , VariableUpdate vu , ReadAccess use ) {
214- defReachesReadWithinBlock ( target , vu , use )
215- or
216- exists ( BasicBlock bb , int i |
217- exists ( refRank ( bb , i , target , Read ( ) ) ) and
218- use = bb .getNode ( i ) and
219- defReachesEndOfBlock ( bb .getAPredecessor ( ) , vu , target ) and
220- not defReachesReadWithinBlock ( target , _, use )
221- )
222- }
223-
224- /** Holds if the update `def` can be used at the read `use`. */
225- cached
226- deprecated predicate defUse ( StackVariable target , Expr def , ReadAccess use ) {
227- exists ( VariableUpdate vu | def = vu .getSource ( ) | variableUpdateUse ( target , vu , use ) )
228- }
229- }
230-
231112/** A node that updates a variable. */
232113abstract class VariableUpdate extends DataFlowNode {
233114 /** Gets the value assigned, if any. */
0 commit comments