//
// Create flow graph
//
log.info("Generating flow graph...");
Intermediate2FlowGraph tr = new Intermediate2FlowGraph(app);
FlowGraph g = tr.convert(alias, reachingDefinitions, assertions);
// Notify diagnostics of flow graph
diagnostics.flowGraphCompleted(g);
Map<Statement, Node> m2 = tr.getTranslationMap();
if (log.isDebugEnabled()) {
log.debug("Statement -> Node:");
for (Map.Entry<Statement, Node> me : m2.entrySet()) {
log.debug(" " + me.getKey() + " -> " + me.getValue());
}
}
log.info("Simplifying flow graph...");
Map<Node, Node> m3 = g.simplify();
Set<Node> nodes = new HashSet<Node>();
for (Statement ss : hotspot_statements) {
Node beforeSimplifyNode = m2.get(ss);
Node n = m3.get(beforeSimplifyNode);
if (n != null) {
nodes.add(n);
}
}
for (StringStatement ss : jt.getToStringHotspotMap().values()) {
Node n = m3.get(m2.get(ss));
if (n != null) {
nodes.add(n);
}
}
for (Node n : m3.keySet()) { // TODO: inefficient, use entrySet iterator instead
Node n2 = m3.get(n);
if (n.isTaint() && n2 != null) {
n2.setTaint(true);
}
}
if (log.isDebugEnabled()) {
log.debug(g.toDot(nodes));
}
log.info("Transforming into grammar...");
FlowGraph2Grammar f2g = new FlowGraph2Grammar(g);
Grammar r = f2g.convert();
Set<Nonterminal> hs_nt = new HashSet<Nonterminal>();