blob: bd12522983a2c69ea666ffa85344c10571b2779a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
package org.checkerframework.dataflow.cfg.block;
import org.checkerframework.dataflow.analysis.Store;
/**
* Implementation of a conditional basic block.
*
* @author Stefan Heule
*/
public class ConditionalBlockImpl extends BlockImpl implements ConditionalBlock {
/** Successor of the then branch. */
protected BlockImpl thenSuccessor;
/** Successor of the else branch. */
protected BlockImpl elseSuccessor;
/**
* The rules below say that the THEN store before a conditional block flows to BOTH of the
* stores of the then successor, while the ELSE store before a conditional block flows to BOTH
* of the stores of the else successor.
*/
protected Store.FlowRule thenFlowRule = Store.FlowRule.THEN_TO_BOTH;
protected Store.FlowRule elseFlowRule = Store.FlowRule.ELSE_TO_BOTH;
/**
* Initialize an empty conditional basic block to be filled with contents and linked to other
* basic blocks later.
*/
public ConditionalBlockImpl() {
type = BlockType.CONDITIONAL_BLOCK;
}
/** Set the then branch successor. */
public void setThenSuccessor(BlockImpl b) {
thenSuccessor = b;
b.addPredecessor(this);
}
/** Set the else branch successor. */
public void setElseSuccessor(BlockImpl b) {
elseSuccessor = b;
b.addPredecessor(this);
}
@Override
public Block getThenSuccessor() {
return thenSuccessor;
}
@Override
public Block getElseSuccessor() {
return elseSuccessor;
}
@Override
public Store.FlowRule getThenFlowRule() {
return thenFlowRule;
}
@Override
public Store.FlowRule getElseFlowRule() {
return elseFlowRule;
}
@Override
public void setThenFlowRule(Store.FlowRule rule) {
thenFlowRule = rule;
}
@Override
public void setElseFlowRule(Store.FlowRule rule) {
elseFlowRule = rule;
}
@Override
public String toString() {
return "ConditionalBlock()";
}
}
|