@@ -10,7 +10,7 @@ private import CIL
10
10
*/
11
11
class BasicBlock extends Cached:: TBasicBlockStart {
12
12
/** Gets an immediate successor of this basic block, if any. */
13
- BasicBlock getASuccessor ( ) { result .getFirstNode ( ) = getLastNode ( ) .getASuccessor ( ) }
13
+ BasicBlock getASuccessor ( ) { result .getFirstNode ( ) = this . getLastNode ( ) .getASuccessor ( ) }
14
14
15
15
/** Gets an immediate predecessor of this basic block, if any. */
16
16
BasicBlock getAPredecessor ( ) { result .getASuccessor ( ) = this }
@@ -31,7 +31,7 @@ class BasicBlock extends Cached::TBasicBlockStart {
31
31
* The basic block on line 2 is an immediate `true` successor of the
32
32
* basic block on line 1.
33
33
*/
34
- BasicBlock getATrueSuccessor ( ) { result .getFirstNode ( ) = getLastNode ( ) .getTrueSuccessor ( ) }
34
+ BasicBlock getATrueSuccessor ( ) { result .getFirstNode ( ) = this . getLastNode ( ) .getTrueSuccessor ( ) }
35
35
36
36
/**
37
37
* Gets an immediate `false` successor, if any.
@@ -49,22 +49,22 @@ class BasicBlock extends Cached::TBasicBlockStart {
49
49
* The basic block on line 2 is an immediate `false` successor of the
50
50
* basic block on line 1.
51
51
*/
52
- BasicBlock getAFalseSuccessor ( ) { result .getFirstNode ( ) = getLastNode ( ) .getFalseSuccessor ( ) }
52
+ BasicBlock getAFalseSuccessor ( ) { result .getFirstNode ( ) = this . getLastNode ( ) .getFalseSuccessor ( ) }
53
53
54
54
/** Gets the control flow node at a specific (zero-indexed) position in this basic block. */
55
- ControlFlowNode getNode ( int pos ) { Cached:: bbIndex ( getFirstNode ( ) , result , pos ) }
55
+ ControlFlowNode getNode ( int pos ) { Cached:: bbIndex ( this . getFirstNode ( ) , result , pos ) }
56
56
57
57
/** Gets a control flow node in this basic block. */
58
- ControlFlowNode getANode ( ) { result = getNode ( _) }
58
+ ControlFlowNode getANode ( ) { result = this . getNode ( _) }
59
59
60
60
/** Gets the first control flow node in this basic block. */
61
61
ControlFlowNode getFirstNode ( ) { this = Cached:: TBasicBlockStart ( result ) }
62
62
63
63
/** Gets the last control flow node in this basic block. */
64
- ControlFlowNode getLastNode ( ) { result = getNode ( length ( ) - 1 ) }
64
+ ControlFlowNode getLastNode ( ) { result = this . getNode ( this . length ( ) - 1 ) }
65
65
66
66
/** Gets the length of this basic block. */
67
- int length ( ) { result = strictcount ( getANode ( ) ) }
67
+ int length ( ) { result = strictcount ( this . getANode ( ) ) }
68
68
69
69
/**
70
70
* Holds if this basic block strictly dominates basic block `bb`.
@@ -114,7 +114,7 @@ class BasicBlock extends Cached::TBasicBlockStart {
114
114
*/
115
115
predicate dominates ( BasicBlock bb ) {
116
116
bb = this or
117
- strictlyDominates ( bb )
117
+ this . strictlyDominates ( bb )
118
118
}
119
119
120
120
/**
@@ -140,14 +140,14 @@ class BasicBlock extends Cached::TBasicBlockStart {
140
140
* does not dominate the basic block on line 6.
141
141
*/
142
142
predicate inDominanceFrontier ( BasicBlock df ) {
143
- dominatesPredecessor ( df ) and
144
- not strictlyDominates ( df )
143
+ this . dominatesPredecessor ( df ) and
144
+ not this . strictlyDominates ( df )
145
145
}
146
146
147
147
/**
148
148
* Holds if this basic block dominates a predecessor of `df`.
149
149
*/
150
- private predicate dominatesPredecessor ( BasicBlock df ) { dominates ( df .getAPredecessor ( ) ) }
150
+ private predicate dominatesPredecessor ( BasicBlock df ) { this . dominates ( df .getAPredecessor ( ) ) }
151
151
152
152
/**
153
153
* Gets the basic block that immediately dominates this basic block, if any.
@@ -226,7 +226,7 @@ class BasicBlock extends Cached::TBasicBlockStart {
226
226
* post-dominates itself.
227
227
*/
228
228
predicate postDominates ( BasicBlock bb ) {
229
- strictlyPostDominates ( bb ) or
229
+ this . strictlyPostDominates ( bb ) or
230
230
this = bb
231
231
}
232
232
@@ -239,7 +239,7 @@ class BasicBlock extends Cached::TBasicBlockStart {
239
239
predicate inLoop ( ) { this .getASuccessor + ( ) = this }
240
240
241
241
/** Gets a textual representation of this basic block. */
242
- string toString ( ) { result = getFirstNode ( ) .toString ( ) }
242
+ string toString ( ) { result = this . getFirstNode ( ) .toString ( ) }
243
243
244
244
/** Gets the location of this basic block. */
245
245
Location getLocation ( ) { result = this .getFirstNode ( ) .getLocation ( ) }
@@ -325,16 +325,16 @@ private predicate exitBB(BasicBlock bb) { not exists(bb.getLastNode().getASucces
325
325
* A basic block with more than one predecessor.
326
326
*/
327
327
class JoinBlock extends BasicBlock {
328
- JoinBlock ( ) { getFirstNode ( ) .isJoin ( ) }
328
+ JoinBlock ( ) { this . getFirstNode ( ) .isJoin ( ) }
329
329
}
330
330
331
331
/** A basic block that terminates in a condition, splitting the subsequent control flow. */
332
332
class ConditionBlock extends BasicBlock {
333
333
ConditionBlock ( ) {
334
334
exists ( BasicBlock succ |
335
- succ = getATrueSuccessor ( )
335
+ succ = this . getATrueSuccessor ( )
336
336
or
337
- succ = getAFalseSuccessor ( )
337
+ succ = this . getAFalseSuccessor ( )
338
338
)
339
339
}
340
340
@@ -380,16 +380,16 @@ class ConditionBlock extends BasicBlock {
380
380
*/
381
381
382
382
exists ( BasicBlock succ |
383
- isCandidateSuccessor ( succ , testIsTrue ) and
383
+ this . isCandidateSuccessor ( succ , testIsTrue ) and
384
384
succ .dominates ( controlled )
385
385
)
386
386
}
387
387
388
388
private predicate isCandidateSuccessor ( BasicBlock succ , boolean testIsTrue ) {
389
389
(
390
- testIsTrue = true and succ = getATrueSuccessor ( )
390
+ testIsTrue = true and succ = this . getATrueSuccessor ( )
391
391
or
392
- testIsTrue = false and succ = getAFalseSuccessor ( )
392
+ testIsTrue = false and succ = this . getAFalseSuccessor ( )
393
393
) and
394
394
forall ( BasicBlock pred | pred = succ .getAPredecessor ( ) and pred != this | succ .dominates ( pred ) )
395
395
}
0 commit comments