use of claw.tatsu.xcodeml.xnode.fortran.FfunctionDefinition in project claw-compiler by C2SM-RCM.
the class LoopTest method mergeTest.
@Test
public void mergeTest() {
Context context = new TestContext();
XcodeML xcodeml = XmlHelper.getDummyXcodeProgram(context);
assertNotNull(xcodeml);
DimensionDefinition d1 = new DimensionDefinition("i", "1", "10");
Xnode inductionI = xcodeml.createVar(FortranType.INTEGER, "i", Xscope.LOCAL);
Xnode l1 = xcodeml.createDoStmt(inductionI, d1.generateIndexRange(xcodeml, true, false));
Xnode l2 = xcodeml.createDoStmt(inductionI, d1.generateIndexRange(xcodeml, true, false));
List<FfunctionDefinition> fctDefs = xcodeml.getAllFctDef();
assertFalse(fctDefs.isEmpty());
FfunctionDefinition f1 = fctDefs.get(0);
int doStmtCnt1 = f1.matchAll(Xcode.F_DO_STATEMENT).size();
f1.body().append(l1);
f1.body().append(l2);
int doStmtCnt2 = f1.matchAll(Xcode.F_DO_STATEMENT).size();
assertEquals(doStmtCnt1 + 2, doStmtCnt2);
try {
Loop.merge(l1, l2);
} catch (IllegalTransformationException e) {
fail();
}
int doStmtCnt3 = f1.matchAll(Xcode.F_DO_STATEMENT).size();
assertEquals(doStmtCnt1 + 1, doStmtCnt3);
}
use of claw.tatsu.xcodeml.xnode.fortran.FfunctionDefinition in project claw-compiler by C2SM-RCM.
the class XmlHelper method createXfunctionDefinitionFromString.
public static FfunctionDefinition createXfunctionDefinitionFromString(String xml) {
Xnode n = XmlHelper.getElementFromString(xml);
assertNotNull(n);
return new FfunctionDefinition(n);
}
Aggregations