use of com.jopdesign.common.code.ControlFlowGraph.CFGNode in project jop by jop-devel.
the class ConstantCache method build.
public ConstantCache build() {
List<MethodInfo> methods = project.getCallGraph().getReachableImplementations(project.getTargetMethod());
for (int i = methods.size() - 1; i >= 0; i--) {
MethodInfo mi = methods.get(i);
ControlFlowGraph cfg = project.getFlowGraph(mi);
for (CFGNode n : cfg.vertexSet()) {
BasicBlock bb = n.getBasicBlock();
if (bb == null)
continue;
for (InstructionHandle ii : bb.getInstructions()) {
extractConstantAddresses(cfg, ii);
}
}
}
return this;
}
use of com.jopdesign.common.code.ControlFlowGraph.CFGNode in project jop by jop-devel.
the class RecursiveWcetAnalysis method edgeToNodeFlow.
public static Map<CFGNode, Long> edgeToNodeFlow(DirectedGraph<CFGNode, ControlFlowGraph.CFGEdge> graph, Map<ControlFlowGraph.CFGEdge, Long> cfgEdgeFlow) {
HashMap<CFGNode, Long> nodeFlow = new HashMap<CFGNode, Long>();
for (CFGNode n : graph.vertexSet()) {
if (// ENTRY and DEAD CODE (no flow)
graph.inDegreeOf(n) == 0)
// ENTRY and DEAD CODE (no flow)
nodeFlow.put(n, 0L);
else {
long flow = 0;
for (ControlFlowGraph.CFGEdge inEdge : graph.incomingEdgesOf(n)) {
flow += cfgEdgeFlow.get(inEdge);
}
nodeFlow.put(n, flow);
}
}
return nodeFlow;
}
use of com.jopdesign.common.code.ControlFlowGraph.CFGNode in project jop by jop-devel.
the class TreeAnalysis method computeWCET.
public long computeWCET(MethodInfo targetMethod) {
this.methodWCET = new HashMap<MethodInfo, Long>();
List<MethodInfo> reachable = project.getCallGraph().getReachableImplementations(targetMethod);
Collections.reverse(reachable);
for (MethodInfo mi : reachable) {
ControlFlowGraph cfg = project.getFlowGraph(mi);
Map<CFGNode, Long> localCost = new HashMap<CFGNode, Long>();
LocalCostVisitor lcv = new LocalCostVisitor(new AnalysisContextCallString(CallString.EMPTY), project);
for (CFGNode n : cfg.vertexSet()) {
localCost.put(n, lcv.computeCost(n).getCost());
}
ProgressMeasure<CFGNode, ControlFlowGraph.CFGEdge> pm = new ProgressMeasure<CFGNode, ControlFlowGraph.CFGEdge>(cfg.getGraph(), cfg.getLoopColoring(), extractUBs(cfg.buildLoopBoundMap()), localCost);
long wcet = pm.getMaxProgress().get(cfg.getExit());
methodWCET.put(mi, wcet);
}
return methodWCET.get(targetMethod);
}
Aggregations