dataflow update
This commit is contained in:
@ -8,9 +8,9 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -28,7 +28,7 @@ public final class DataFlowGraph implements Iterable<DataFlowNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static DataFlowGraph fromFlowGraph(FlowGraph flowGraph) {
|
public static DataFlowGraph fromFlowGraph(FlowGraph flowGraph) {
|
||||||
final List<DataFlowNode> dataFlowNodes = new LinkedList<>();
|
final List<DataFlowNode> dataFlowNodes = new ArrayList<>();
|
||||||
|
|
||||||
// Initialize all DataFlowNodes
|
// Initialize all DataFlowNodes
|
||||||
for (FlowBasicBlock basicBlock : flowGraph) {
|
for (FlowBasicBlock basicBlock : flowGraph) {
|
||||||
@ -84,7 +84,7 @@ public final class DataFlowGraph implements Iterable<DataFlowNode> {
|
|||||||
return this.dataFlowNodes.size();
|
return this.dataFlowNodes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream<DataFlowNode> stream() {
|
public Stream<DataFlowNode> stream() {
|
||||||
return this.dataFlowNodes.stream();
|
return this.dataFlowNodes.stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,16 +92,16 @@ public final class DataFlowNode {
|
|||||||
return Collections.unmodifiableSet(this.predecessors);
|
return Collections.unmodifiableSet(this.predecessors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPredecessor(DataFlowNode node) {
|
public boolean addPredecessor(DataFlowNode node) {
|
||||||
this.predecessors.add(node);
|
return this.predecessors.add(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<DataFlowNode> getSuccessorSet() {
|
public Set<DataFlowNode> getSuccessorSet() {
|
||||||
return Collections.unmodifiableSet(this.successors);
|
return Collections.unmodifiableSet(this.successors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSuccessor(DataFlowNode node) {
|
public boolean addSuccessor(DataFlowNode node) {
|
||||||
this.successors.add(node);
|
return this.successors.add(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getUseSet() {
|
public Set<String> getUseSet() {
|
||||||
|
Reference in New Issue
Block a user