use of com.jopdesign.common.code.LoopBound in project jop by jop-devel.
the class JavaOneProcessPerSupergraphTranslator method recordLoops.
// Global maximal nesting depth is given by the equation
// node.gmnd = node.method.gmnd + (node.loop ? node.loop.nestingDepth : 0)
// method.gmnd = max { cs.method.gmnd + cs.gmnd | cs <- method.callsites }
// Example:
// main() { for() for() X: f(); }
// f() { for() for(HOL) }
// nesting depth of HOL is 2
// gmnd of f is gmnd of X = 2 + gmnd of main = 2
// gmnd of HOL is 4
private void recordLoops(TemplateBuilder tBuilder) {
try {
computeMethodNestingDepths();
} catch (BadGraphException e) {
throw new BadGraphError(e);
}
for (MethodInfo m : methodInfos) {
ControlFlowGraph cfg = project.getFlowGraph(m);
for (Entry<CFGNode, LoopBound> entry : cfg.buildLoopBoundMap().entrySet()) {
CFGNode hol = entry.getKey();
LoopBound lb = entry.getValue();
int nesting = cfg.getLoopColoring().getLoopColor(hol).size();
int gmnd = nesting + methodMNDs.get(m);
tBuilder.addLoop(hol, gmnd, lb);
}
}
if (config.debug)
tBuilder.dumpLoops();
}
use of com.jopdesign.common.code.LoopBound in project jop by jop-devel.
the class ParserTest method parseTest.
private static void parseTest(String string) {
System.out.println("Parsing: '" + string + "'");
InputStream is = new ByteArrayInputStream(string.getBytes());
Scanner scanner = new Scanner(is);
Parser parser = new Parser(scanner);
try {
parser.Parse();
LoopBound loopBound = parser.getResult();
System.out.println(loopBound);
} catch (Error e) {
e.printStackTrace();
}
}
Aggregations