use of cx2x.translator.transformation.loop.LoopFusion in project claw-compiler by C2SM-RCM.
the class IterationSpace method tryFusion.
/**
* Analyze the dependence information at each level and try to merge
* independent do statements.
*
* @param xcodeml Current XcodeML/F program unit.
* @param transformer Current transformer.
* @param master ClawLanguage that triggered this transformation.
* @throws Exception If the fusion fails.
*/
public void tryFusion(XcodeProgram xcodeml, Transformer transformer, ClawLanguage master) throws Exception {
for (int i = _levels.size() - 1; i >= 0; --i) {
List<DependenceAnalysis> loopsAtLevel = getLevel(i);
DependentTransformationGroup fusions = new DependentTransformationGroup("parallelize-fusion");
for (DependenceAnalysis dep : loopsAtLevel) {
if (dep.isIndependent()) {
ClawLanguage l = ClawLanguage.createLoopFusionLanguage(master);
LoopFusion fusion = new LoopFusion(dep.getDoStmt(), l);
fusions.add(fusion);
}
}
fusions.applyTranslations(xcodeml, transformer);
}
}
use of cx2x.translator.transformation.loop.LoopFusion in project claw-compiler by C2SM-RCM.
the class TransformationHelper method applyFusionClause.
/**
* Generate loop fusion transformation if the clause is present in the
* directive.
*
* @param claw ClawLanguage object that tells encapsulates all
* information about the current directives and its
* clauses.
* @param transformer Transformer object in which new transformation are
* added.
* @param stmt Statement on which the transformation is attached. Must
* be a FdoStatement for the loop fusion transformation.
*/
private static void applyFusionClause(ClawLanguage claw, Transformer transformer, Xnode stmt) {
if (claw.hasFusionClause() && stmt.opcode() == Xcode.FDOSTATEMENT) {
ClawLanguage l = ClawLanguage.createLoopFusionLanguage(claw);
LoopFusion fusion = new LoopFusion(stmt, l);
// TODO maybe run analysis
transformer.addTransformation(fusion);
if (XmOption.isDebugOutput()) {
System.out.println("Loop fusion added: " + claw.getGroupValue());
}
}
}
Aggregations